Page 1 of 1

VERY Simple IF Question

Posted: Sun May 14, 2006 7:23 pm
by myuusmeow
(I just started learning BASIC yesterday, and want to be "ok" with it by June 14, my birthday.)

Code: Select all

CLS
PRINT "Guess the Random Number"
PRINT "Hint: It is less than 11"
PRINT "Only 3 chances!"
RANDOMIZE TIMER
number = INT(RND * 10)
INPUT "1st chance?", number1
IF number1 = number THEN PRINT "You won!" ELSE PRINT "Too bad."
INPUT "2nd chance!", number2
IF number2 = number THEN PRINT "You won!" ELSE PRINT "Oh no!"
INPUT "3rd, and last chance!!!", number3
IF number3 = number THEN PRINT "You won!" ELSE PRINT "Too bad, it was "; number; "."
In

Code: Select all

... = number THEN PRINT "You won"
, I want to put an END in there, but, I can't.
I've tried

Code: Select all

... = number THEN PRINT "You won!" END
and

Code: Select all

... = number THEN PRINT "You won!" AND END
.

Otherwise I got it right, and it keeps going.

Posted: Sun May 14, 2006 7:50 pm
by MystikShadows
Hi there myuusmeow

you were very close

... = number THEN PRINT "You won!" END

should be

... = number THEN PRINT "You won!": END

not the colon before your END statement..that should work for you

Posted: Sun May 14, 2006 7:58 pm
by myuusmeow
Hey, thanks for the quick reply! :D It worked great... I think, I can't guess the number to test it :P.

Posted: Sun May 14, 2006 8:45 pm
by moneo
Out of the past come the thundering hoofs of the great horse Silver --- MysticShadows rides again....

Posted: Sun May 14, 2006 8:48 pm
by MystikShadows
Wow, I positively love that moneo. Can I use it? hehe...

Posted: Mon May 15, 2006 8:12 pm
by moneo
MystikShadows wrote:Wow, I positively love that moneo. Can I use it? hehe...
Only if you leave me a silver bullet next time you help me out. :wink: