[↑]
ON
- Branch to the label line corresponding to the value of the expression
ON Expression GOTO @Label0,@Label1…
- Branch to the label line corresponding to the value of the expression and return to the next command after ON GOSUB by using the RETURN command
ON Expression GOSUB @Label0,@Label1…
- Register the jump destination when the user tries to stop the program
ON BREAK GOTO @Label
1. Branch to the label line corresponding to the value of the expression
ON Expression GOTO @Label0,@Label1…
Arguments
Expression
The jump destination is selected according to the value of the expression written here.
・The value must be numeric.
@Label0
Jump destination when the value of the expression is 0
@Label1
Jump destination when the value of the expression is 1
・Prepare as many destinations as you need.
・Strings cannot be used for the ON to GOTO labels.
Example
ON IDX GOTO @JMP_A,@JMP_B
PRINT OVER:END
@JMP_A
PRINT "IDX=0":END
@JMP_B
PRINT "IDX=1":END
2. Branch to the label line corresponding to the value of the expression and return to the next command after ON GOSUB by using the RETURN command
ON Expression GOSUB @Label0,@Label1…
Arguments
Expression
The jump destination is selected according to the value of the expression written here.
The value must be numeric.
@Label0
Jump destination when the value of the expression is 0
@Label1
Jump destination when the value of the expression is 1
:
・Prepare as many destinations as you need.
・Strings cannot be used for the ON to GOSUB labels.
Example
ON IDX GOSUB @SUB_A,@SUB_B
PRINT EXIT:END
@SUB_A
PRINT "IDX=0":RETURN
@SUB_B
PRINT "IDX=1":RETURN
3. Register the jump destination when the user tries to stop the program
ON BREAK GOTO @Label 
・If you press the + Button during program execution, the program will normally stop. But, you use ON BREAK GOTO to jump to the specified label.
・Once you jump to the registered label, the registration is canceled.
・If the program stops due to an error, TRACE,STOP execution, forced stop by pressing + Button, programs start from the Top Menu, etc., it will not jump even if a label is registered.
Argument
@Label
Jump destination when program stops
Example
ON BREAK GOTO @FINISH
LOOP
ENDLOOP
@FINISH
PRINT "Stopped!"
About this site
Our site is an unofficial manual site of programming software "SmileBASIC" for NintendoSwitch™.
I acquire the content of the site from the
official reference site
of the
SmileBoom Co.Ltd.
that is the development and sales cause of the software in real time (a minimum period of 24 hours update) and display it.
For automatic update, contents may become improper.
Please confirm the correct content in an official site.
June 3, 2020
by mim
OK
|