Differences

This shows you the differences between two versions of the page.


Previous revision
—on [2026/09/18 15:53] (current) – [Syntax] jjflash
Line 1: Line 1:
 +====== ON ======
  
 +[pet] [vic20] [c64] [c16] [cplus4] [c128] [x16] [m65]
 +
 +The ''ON ... GOTO|GOSUB'' construct has multiple use cases:
 +
 +  * ''ON <value> GOTO|GOSUB'' is used for multiple branching
 +  * ''ON ERROR GOTO'' is used for error trapping
 +  * ''ON <event> GOSUB'' is used for interrupt handling
 +
 +===== Syntax =====
 +
 +<code xcbasic>
 +ON <value> GOTO|GOSUB <label> [, <label> ...]
 +ON ERROR GOTO <label>
 +ON TIMER|RASTER|SPRITE|BACKGROUND|VBLANK GOSUB <label>
 +</code>
 +
 +For more details, refer to:
 +
 +  * [[flowcontrol|]]
 +  * [[error_handling|]]
 +  * [[interrupts|]]