BASIC Programming/Beginning BASIC/Control Structures/WHILE...WEND

From Wikibooks, open books for an open world
Jump to: navigation, search
 INPUT "What is your name"; UserName$
 PRINT "Hello "; UserName$
 DO 
   INPUT "How many stars do you want"; NumStars
   Stars$ = ""
   Stars$ = REPEAT$("*", NumStars) '<-ANSI BASIC
   'Stars$ = STRING$(NumStars, "*") '<-MS BASIC
   PRINT Stars$
   DO
     INPUT "Do you want more stars"; Answer$
   LOOP UNTIL Answer$ <> ""
 LOOP WHILE UCASE$(LEFT$(Answer$, 1)) = "Y"
 PRINT "Goodbye ";
 FOR A = 1 TO 200
   PRINT UserName$; " ";
 NEXT A
 PRINT