Skip to main content

And

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.

And block

Description​

The And block 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. This is a code block from the Logic drawer.

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:

  • A comparative statement block (= statements, > statements, not statement, and/or statements)
  • Another comparative statement block

Example​

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 below 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.

And example code
  • Or - Returns true if at least one input is true
  • Not - Returns the opposite boolean value