Why is this not working...

Sorry for lack of comments, was just trying to make a program i need to write for school work before doing it properly. At the case statement at the end "Case < integer" it returns the error "must be a number". CODE:

LOCAL difficulty$, guess, integer

DECLARE DEF higher_or_lower

DO
INPUT PROMPT ("Would you like to play guess number on easy, medium or hard?"): difficulty$
Select Case difficulty$
Case "easy"

RANDOMIZE
LET integer = int(20*rnd)
DO
DO
INPUT PROMPT ("Guess a number between one and twenty") : guess
LOOP UNTIL guess => 0 AND guess <= 20
CALL higher_or_lower (guess, integer)
LOOP UNTIL guess = integer

Case "medium"
RANDOMIZE
LET integer = int(50*rnd)
DO
DO
INPUT PROMPT ("Guess a number between one and fifty") : guess
LOOP UNTIL guess => 0 AND guess <= 50
CALL higher_or_lower (guess, integer)
LOOP UNTIL guess = integer

Case "hard"
RANDOMIZE
LET integer = int(100*rnd)
DO
DO
INPUT PROMPT ("Guess a number between one and a hundred") : guess
LOOP UNTIL guess => 0 AND guess <= 100
CALL higher_or_lower (guess, integer)
LOOP UNTIL guess = integer

CASE ELSE
PRINT "Error. Try again."
End SELECT
LOOP UNTIL difficulty$ = "easy" OR difficulty$ = "medium" OR difficulty$ = "hard"

END

SUB higher_or_lower (guess, integer)
SELECT CASE guess
CASE IS < integer
PRINT "The number is higher. "
CASE IS > integer
PRINT "The number is lower. "
CASE ELSE
END SELECT
END SUB

Comments

CASE statement

Hi,

Unlike IF....THEN statements, SELECT CASE requires that you specify CONSTANTS, i.e. numbers or string constants in quotes.

You cannot use 'integer' because it is a variable name.

You must use something like:

CASE 5
!i.e when guess=5 this is the option that will be executed.

Big John