Logic
Logic blocks provide the fundamental building blocks for creating conditional statements, Boolean operations, and control flow in your StarLogo Nova programs.
Overview
Logic blocks allow you to create decision-making structures in your simulations. They help agents and the simulation environment respond intelligently to different conditions and states, enabling complex behaviors and interactive responses.
Block Categories
Control Flow
- If - Executes code only if a condition is true
- If Else - Executes one set of code if true, another if false
- While - Repeatedly executes code while a condition remains true
- Repeat Times - Repeats code execution a specified number of times
Probability & Timing
- With % Chance - Executes code with a specified probability
- Yield - Pauses execution and allows other processes to run
Comparison Operators
- Equals - Checks if two values are equal
- Not Equals - Checks if two values are not equal
- Less Than - Checks if first value is less than second
- Greater Than - Checks if first value is greater than second
- Less Than Or Equal To - Checks if first value is less than or equal to second
- Greater Than Or Equal To - Checks if first value is greater than or equal to second
Boolean Operations
- And - Returns true only if both conditions are true
- Or - Returns true if at least one condition is true
- Not - Inverts a boolean value