How to input an integer variable?
-
I want to create a "Guess my number" game and the player needs to input a number.
All this works fine but: the variable is a string and throws an error if I am comparing to the computerNumber which is an integer.
How can I solve this problem and input an int ?
I found getKeyboardBuffer but I don't know if I am on the right track with this ;-)Could someone please help me?
Happy coding!
-
@kyborg I think using input() is fine as you can use int() to convert the string to a number, eg:
inputNumber = input( "Guess a number" ) if int( inputNumber ) == computerNumber then
-
@kat thank you very much :-)
This solved my problem.Is it possible to buy a paper book of all of the commands?
I found a PDF of it but would like to touch paper :-) -
@kyborg Great! Glad I could help :)
Unfortunately, I think due to the sheer volume of information and the resulting printing costs it's something we're unable to offer.