try: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(added better short example, link to long description)
mNo edit summary
Line 26: Line 26:


Any thrown exception in a '''try''' block is caught in a [[catch]] block.
Any thrown exception in a '''try''' block is caught in a [[catch]] block.


'''Example:'''
'''Example:'''

Revision as of 12:22, 23 July 2006


try code


Operand types:

code: Code

Type of returned value:

Nothing

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 {
    ....
  }
}