And

From StarLogo Nova Wiki
Other languages:
The And Block

Usage

Determines if both the first and second inputs are true. If both are true, then returns true; if one or both of the statements are false, this block returns as false.

Syntax

Inputs in this block:

  1. a comparative statement block (= statements, > statements, not statement, and/or statements)
  2. another comparative statement block

Example

And example code

This is a model of a quarantine. Doctors (pink cubes) find sick agents roaming around the unquarantined area (green terrain) and move them to the quarantine (white terrain). Further, they also remove immune agents (blue) from the quarantine and move them to the unquarantined area. Note that movement from the unquarantined area to the quarantined area changes the trait quarantined? from 0 to 1.

The ‘check spot’ procedure above ensures quarantined agents remain on white terrain and unquarantined agents remain on green terrain. This function utilizes the and block in order to see if an agent’s quarantine state matches their current position.