跳至内容

BASIC 编程/BASIC 入门/控制结构/WHILE...WEND

来自维基教科书,开放世界的开放书籍
 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
华夏公益教科书