Home > Language Reference > Program Flow Functions > End


The End function ends current execution and can return a value.


Used to stop immediately an execution and return a value to a calling script where the return code can be processed.




<ret>, optional, integer, constant. This value can then be used by the calling script. The default value is 0.

See also

Parameters passed from one script to another


' Script 1
    'Loop until script2 returns 0 for a maximum of 3 iterations
        'Kill Internet Explorer as script2 launches it
    until ret=0 OR i=3 

'Script 2
    #IgnoreErrors=1  'Ignore errors
    ' Test the return code of UsePage, if the page is not loaded within 30 seconds (default timeout), 
    'end the script with a return code of 2
    ret=UsePage("WinTask Demonstration")
    If ret <> 0 then   'If the return code of UsePage is not 0, there is an error, end the script with return code 2
        End(0)      'The UsePage succeeded, end the script with return code 0