RosettaCodeData/Task/Guess-the-number-With-feedback/ZX-Spectrum-Basic/guess-the-number-with-feedback.basic
2023-07-01 13:44:08 -04:00

5 lines
369 B
Text

ZX Spectrum Basic has no [[:Category:Conditional loops|conditional loop]] constructs, so we have to emulate them here using IF and GO TO.
1 LET n=INT (RND*10)+1
2 INPUT "Guess a number that is between 1 and 10: ",g: IF g=n THEN PRINT "That's my number!": STOP
3 IF g<n THEN PRINT "That guess is too low!": GO TO 2
4 IF g>n THEN PRINT "That guess is too high!": GO TO 2