Skip to content

not

Syntax

not(numeric_expression)

Parameters

numeric_expression :
an expression that evaluates to a boolean value

Returns

1 (true) if numeric_expression is false, and 0 (false) otherwise.

Description

Logical not operation. Returns the opposite of its argument.

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

All agents except for those who are 18 years old are selected for state Selected with:

state A {
    wait(0)
    next_if(Selected, not(age() == 18))
    default(Excluded)
}

See Also