keypad Library - waitForKey()

I am new to arduino and c language, however i have programmed in c++.

i am doing a senior project on the game mastermind which is a code breaking game. I need to figure out how to wait for a key to be pressed in a for loop to create a value in an array. I came across the waitForKey() function but do not know how to use it. Here is the section of code i need help with.

for (i = 0; i < 4; i++)


usercharcode*= customKeypad.waitForKey();*
_ usercode = charchoice -‘0’;_
_ lcd.print(usercode*);
if (usercode != 1 && usercode != 2 && usercode != 3 && usercode != 4 && usercode != 5 && usercode != 6)
lcd.print(“Enter # from 1-6”);
usercharcode = customKeypad.getKey();
usercode = usercharcode - ‘0’;

* }*
*I Get an error message that says *
exit status 1
‘class Keypad’ has no member named ‘waitforkey’
yet this is straight from the arduino website.

Do you have the Keypad.h library installed in your /libraries folder? Do you call it out in your sketch? I don't think it is one of the included libraries in the IDE like Serial or SPI or I2C. I don't see it listed in 1.8.1 for example.

Not the problem that you are asking about but

usercharcode= customKeypad.waitForKey();
              usercode = charchoice -'0';

where is charchoice declared and given a value ?