or¶
Syntax¶
Parameters¶
boolean_expression_1andboolean_expression_2:- Expressions that are evaluated as truthy (non-zero) or falsey (zero).
Returns¶
Returns 1 (true) if either expression parameter is truthy (non-zero). Returns
0 (false) otherwise.
Description¶
Logical disjunction action.
The or function employs short-circuit
evaluation: if the
first argument is true, the second argument is not evaluated.
Truthy and Falsey Values¶
Like in many programming languages, FRED's numeric expressions can be evaluated as either true or false. Values that evaluate to true are considered "truthy", and values that evaluate to false are considered "falsey".
In FRED, a value of 0 is falsey, and all non-zero values are truthy.
Examples¶
The example below moves all agents that are not in their twenties to the state
Selected.