try: Difference between revisions
Jump to navigation
Jump to search
m (try controls the flow) |
(added better short example, link to long description) |
||
Line 21: | Line 21: | ||
'''Description:''' | '''Description:''' | ||
Defines try-catch structure. | Defines a try-catch structure. | ||
This | This sets up an [[Exception handling|exception handling]] block. | ||
Any thrown exception in '''try''' block is caught in [[catch]] block. | Any thrown exception in a '''try''' block is caught in a [[catch]] block. | ||
'''Example:''' | |||
'''try''' { | |||
'''try''' | if (_name == "") then { | ||
[[throw]] "No Name" | |||
[[catch]] { | } | ||
} | |||
[[catch]] { | |||
if (_exception == "No Name") then { | |||
.... | |||
} | |||
} |
Revision as of 05:04, 23 July 2006
try code
Operand types:
code: Code
Type of returned value:
Compatibility:
Version 2.60 required.
Description:
Defines a try-catch structure.
This sets up an exception handling block.
Any thrown exception in a try block is caught in a catch block.
Example:
try { if (_name == "") then { throw "No Name" } } catch { if (_exception == "No Name") then { .... } }