GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Download
  • News
  • Community
  • Resources
  • Language Reference
  • SmallBASIC Manual

This view

  • Original page
  • New address

GeezerVison is showing smallbasic.github.io — SmallBASIC | EXIT

Edit History

EXIT

EXIT [FOR|LOOP|SUB|FUNC]

Home > Reference > Language

Exits a multi line function definition, a loop, or a subprogram. By default (if no parameter is specified) exits from last command block (loop, for-loop or routine).

  • FOR - Exit from the last FOR-NEXT loop
  • LOOP - Exit from the last WHILE-WEND or REPEAT-UNTIL loop
  • SUB - Return from the current routine
  • FUNC - Return from the current function

Example 1: for

for i = 1 to 100
    print i
    exit for
next

' Output: 1

Example 2: while

while(i)
    i++
    print i
    exit loop
wend

' Output: 1

Example 3: sub

sub MySub(a)
    exit sub
    print a
end

MySub(10)  ' No output, because print in MySub will not be reached

Example 4: func

func MyFunc(a)
    exit func
    return a + 10
end

print MyFunc(10)  ' Output: 0, because return command in MyFunc will not be reached
Code samples using EXIT
000 hello.bas   004 loops.bas   006 arrays+.bas   2048.bas   7gables.bas   agendus.bas   anball 1.0.bas   anomail.bas   Another center finder.bas   another look at trig functions.bas   autumn scene.bas   bairstow.bas   Ball.bas   base64.bas   biorythms.bas   blackbox.bas   Blackbox.bas   bomb.bas   bowling7.bas   btn 21.bas   bulls and cows.bas   calc.bas   checkers.bas   chess.bas   circ.bas   circles Kalide v2.bas   circumscribe triangle.bas   clock.bas   clock.bas  
Language
AND   AS   BAND   BG   BOR   BYREF   CALL   CASE   CATCH   CONST   DECLARE   DEF   DO   ELIF   ELSE   ELSEIF   END   END TRY   ENDIF   EQV   EXIT   FALSE   FI   FOR   FUNC   GOSUB   GOTO   IF   IFF   IMP   IN   LABEL   LET   LIKE   LOCAL   LSHIFT   MDL   MOD   NAND   NEXT   NOR   NOT   ON   OR   REM   REPEAT   RETURN   RSHIFT   SELECT   STEP   STOP   SUB   THEN   THROW   TO   TRUE   TRY   UNTIL   USE   USG   USING   WEND   WHILE   XNOR   XOR  
This page was last edited on Sun, 26 Feb 2023 20:10:23 +0100 | Markdown processed with pandoc 3.1.12.1
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.