Goto or Go to

Program flow management function.

The Goto function causes the execution of the script to jump to another line.

Usage

Even if Goto is an easy way to make a jump to another section of the script, it makes scripts unreadable and difficult to debug. Use instead Sub to call a sub-program which executes the section you want.

Syntax

Goto <label>

Go to <label>

Parameters

<label>, the script continues execution directly after this label. In the GoTo statement, <label> is not followed by a semicolon (:) but the definition of this label in the program must be followed by : (no blank).
The compiler detects errors such as <label> not defined, or multiple definitions of the same <label>.

Example code

 

next:

 

  ret=msgbox("Would you like to continue ?",4,"EXAMPLE")

 

  if ret=7 then

stop

  endif

 

'the loop is repeated until you click " No " in the message box

 

goto next

'How to replace the goto by a better structure using Sub

Sub continue()

ret=msgbox("Would you like to continue ?",4,"EXAMPLE")

EndSub

 

ret=0

While ret<>7

continue()

WEnd