On Goto / Gosub

Goto:    Go to a specified label based on the value of an index
Gosub: Call a specified subroutine based on the value of an index

Syntax:
On value Goto label list
On value Gosub label list

index

Required. A variable specifying which label to jump to

label list

Required. A list of comma separated labels

 

Example:

The following function will return a value of 8

Function onTest()
  Dim x as uByte
  Dim ret as uByte

  x=3

  On x Goto j1,j2,j3,j4,j5,j6
  ret=100
  Return

j1: ret=10: return
j2: ret=9:  return
j3: ret=8:  return
j4: ret=7:  return
j5: ret=6:  return
j6: ret=5:  return

End Function ret

Also See: Goto, Gosub