Hi
Ive only recently started using QBasic at college and I would like to know how to loop something if a certain value is met... heres a silly example
DIM Username AS STRING
DIM Sentence AS STRING
CLS
INPUT "Please type your user name"; Username
INPUT "Please type sentence(s)"; Sentence
CLS
PRINT Sentence
IF Username = Mance THEN
PRINT "Invalid sentence structure, please input again"
ELSE
PRINT "Good job!"
END IF
How would I make the user 'Mance' have to start from the beginning?
Thanks...
New to QBasic
Moderators:Administrator, Global Moderator
The easiest (though not the most popular) in this particular situation is with a goto
(I also replace input with line input)
Code: Select all
DIM Username AS STRING
DIM Sentence AS STRING
START:
CLS
LINE INPUT "Please type your user name"; Username
LINE INPUT "Please type sentence(s)"; Sentence
CLS
PRINT Sentence
IF Username = Mance THEN
PRINT "Invalid sentence structure, please input again"
GOTO START
ELSE
PRINT "Good job!"
END IF
Code: Select all