modding:function:if
This is an old revision of the document!
if
| Syntax | (if condition exp1 [exp2]) → value |
|---|---|
| Arguments | 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 | value: 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") )
Return to Functions list
modding/function/if.1419655255.txt.gz · Last modified: (external edit)
