Public Group

# a beginner with a confusing question.

This topic is 4965 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I need some help with this code. It never says "guess higher" even when u guess the number 1. (i used blitz basic) ;CAMERONS's guessing game v3.0 Function SCR() Delay 200 End Function ESC=1 Print "S" SCR() Print "C" SCR() Print "R" SCR() Print "O" SCR() Print "L" SCR() Print "L" SCR() Print " " SCR() Print "D" SCR() Print "O" SCR() Print "W" SCR() Print "N" Print "STOP!" Print"PRESS ANY KEY" WaitKey() Cls ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Print "WELCOME" AppTitle "CAMERON'S GUESSING GAME" SeedRnd MilliSecs() N2G=Rand(1-100) NOG=NOG+1 Repeat GUESS=Input("GUESS A NUMBER BETWEEN 1 AND 100 ") If GUESS>100 Or GUESS < 1 Print ("PICK A NUMBER BETWEEN 1 AND 100 ") ElseIf GUESS < N2G Print "GUESS HIGHER DOWG " ElseIf GUESS > N2G Print "GUESS LOWER MAN " EndIf Until GUESS=N2G Cls Print "YOU GUESSED THE NUMBER "+N2G+" IN "+NOG+" TRIES " While Not KeyHit(ESC) Print "PRESS ESC TO EXIT" SCR() Wend It keeps saying things like"elseif without if" and endif without if thanks in advance

##### Share on other sites
Never used Blitz Basic, but a little googling makes me think this is atleast one of your culprits:

N2G=Rand(1-100)

Shouldn't that be: N2G=Rand(1,100)

?

##### Share on other sites
I'm also not familiar with Blitz Basic, but try putting parenthesis around the Or clause in the if statement:

If (GUESS > 100 Or GUESS < 1)

You mentioned that it was giving errors - can you post the exact error message it produces? Does it indicate what line caused the error?

##### Share on other sites
Quote:
 Original post by ApochPiQI'm also not familiar with Blitz Basic, but try putting parenthesis around the Or clause in the if statement:If (GUESS > 100 Or GUESS < 1)You mentioned that it was giving errors - can you post the exact error message it produces? Does it indicate what line caused the error?

Thanks ApochPiQ...THat Helped

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 10
• 11
• 13
• 9
• 11
• ### Forum Statistics

• Total Topics
634090
• Total Posts
3015430
×