stop

The stop statement stops all running procedures immediately.


Parameters

No parameters.


Description

A procedure continues running until it reaches the last statement in the procedure or it encounters a stop statement. The return statement will also stop a procedure if the procedure has not been called as a subroutine. If you only want the procedure to stop under certain conditions you should use the stop statement with if or case statements.

This example will cause the procedure to stop running if the current value of price is less that the current value of cost.

if price<cost
    message "That's all folks"
    stop
endif
Qty=Qty+1

Advanced Note: The stop statement is not allowed when errors are being trapped with the try and catch statements (see Error Handling). If a stop statement is used within that context, it will throw an error instead of stopping, which will cause the code to skip to the catch statement so that the code can complete in an organized fashion.

try
    ...
    ...
    stop
    ...
    ...
catch
    let errorMessage = info("error")
    if errorMessage beginswith "stop "
        ...
    endif
endcatch

The rational for this is that if you’re using try/catch, that means that you need the code to finish no matter what. It’s probably best to not use stop at all in this type of sitation, but if you do so accidentally (for example if you call someone else’s code that wasn’t planned for this restriction), you’re covered. For example if a stop statement gets used in an .Initialize procedure or in server code, this feature makes sure that the database initialization is completed and that the server doesn’t stop without returning any reply (even if the reply is an error message).


See Also


History

VersionStatusNotes
10.0No ChangeCarried over from Panorama 6.0.