Functions Documentation
View Function Edit Function
Name if
Syntax (if condition exp1 [exp2]) -> value of invoked expression
Argument List condition: anything that evaluates to Nil or non-Nil
exp1: an expression that gets invoked if 'condition' evaluates to non-Nil (if it is 'true')
[exp2]: an optional expression that gets invoked if 'condition' evaluates to Nil (i.e. is 'false')
Returns Whatever the expression that gets invoked returns
Category control structure
Description Basic branching function. Allows executing something only if a certain condition is met. A fundamental thing.
Example
(if (eq (sysGetNode) "SE")
    (objSendMessage gPlayerShip Nil "We are still in Eridani system")
    (objSendMessage gPlayerShip Nil "We are on the journey to the core")
)
Comment It's hard to imagine a script of more than several functions which wouldn't contain some sort of branching, either with 'if' or 'switch' functions.