Skip to main content

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

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

Boolean Values

  • True - Represents the boolean value true
  • False - Represents the boolean value false