cruxLang

Conditions

Control when rules execute with conditional expressions.

Basic Conditions

crux
// Property comparisons
when energy > 20
when mood == "happy"
when speed <= 5

// Boolean conditions
when is_moving
when not is_resting

Compound Conditions

crux
// AND - both must be true
when energy > 20 and mood == "happy"

// OR - either can be true
when is_hungry or is_tired

// Complex combinations
when (energy > 50 and mood == "happy") or is_excited

Comparison Operators

==Equal to
!=Not equal to
>Greater than
<Less than
>=Greater than or equal
<=Less than or equal

Property Access

Access agent properties directly in conditions:

crux
when agent.energy > 50
when agent.state.mood == "calm"
when tick > 100