Clear method stack

Command group Flag affected Reversible Execute on client Platform(s)
Methods NO NO NO All


Clear method stack


This command cancels all currently executing methods and clears the method stack. A Clear method stack at the beginning of a method terminates all the methods in the chain which called the current method but without quitting the current method. $control() methods are not cleared.

As each method calls another, a return point is stored so that control can pass to the command following Do method or Do code method as the called method terminates. When the current method terminates, control returns to the method which was running before it was called.

The Clear method stack command clears all the return points and is used if the method commences a completely new operation. This command followed by a Quit method is the same as Quit all methods.

WARNING It is unwise to clear the method stack if local variables have been passed as fieldname parameters and you continue executing the current method. This will break all local variables on the stack.


; Calling method
Calculate iMyVar as 1
Do method Message
; the following message never gets displayed
Do iMyVar+1
OK message {iMyVar=[iMyVar]}
; Method Message
Clear method stack
Do iMyVar+1
; This message prints iMyVar=2
OK message {iMyVAR=[iMyVar]}
Quit method