ON
The ON … GOTO|GOSUB
construct has multiple use cases:
ON <value> GOTO|GOSUB
is used for multiple branchingON ERROR GOTO
is used for error trappingON <event> GOSUB
is used for interrupt handling
Syntax
ON <value> GOTO|GOSUB <label> [, <label> ...] ON ERROR GOTO <label> ON TIMER|RASTER|SPRITE|BACKGROUND GOSUB <label>
For more details, refer to: