? WHILE/REPEAT loops ● SmileBASIC Source

Sign In

Register
*Usernames are case-sensitive
Forgot my password
Another contest? You asked for it!

WHILE/REPEAT loops

WHILE ... WEND

WHILE condition 'if condition is 0, jump past WEND 'Code to run WEND 'jump to WHILEThe same thing, but written using IF and GOTO:@LOOP IF condition==0 THEN GOTO @EXIT 'Code GOTO @LOOP @EXIT

REPEAT ... UNTIL

REPEAT 'code UNTIL condition 'if condition is 0, jump to REPEAT GOTO equivalent:@LOOP 'code IF condition==0 THEN GOTO @LOOP

Examples

Infinite loop: WHILE 1 'code WEND Wait for key press: REPEAT KEY$=INKEY$() UNTIL KEY$!="" ?KEY$
Author
12Me21
Updated
Rating
0 votes
Categories
Keywords
  • while
  • wend
  • repeat
  • until
  • loop
  • goto
4 Comment(s) Lumage Lumage Head Admin Use header tags. 12Me21 12Me21 Admin Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself ok. SquareFingers SquareFingers For IF INSTR(string$,substring$)+1 THEN... better to have IF INSTR(string$,substring$)<0 THEN... 12Me21 12Me21 Admin Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself It doesn't really make a difference