And: Difference between revisions

From StarLogo Nova Wiki
(add tooltip text)
(Marked this version for translation)
 
(2 intermediate revisions by the same user not shown)
Line 2: Line 2:
<translate>
<translate>


<p id="tooltip">Determines if both the first and second inputs are true. If both are true, then returns true; else returns false.</p>
<!--T:3-->
<section begin="image"/>[[File:and.png|alt=The And Block|thumb]]<section end="image"/>
 
==Usage== <!--T:4-->
 
<!--T:2-->
<p id="tooltip">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.</p>
 
==Syntax== <!--T:5-->
 
<!--T:6-->
Inputs in this block:
#a comparative statement block ([[Special:MyLanguage/Equals|=]] statements, [[Special:MyLanguage/Greater Than|>]] statements, [[Special:MyLanguage/Not|not]] statement, [[Special:MyLanguage/And|and]]/[[Special:MyLanguage/Or|or]] statements)
#another comparative statement block
 
==Example== <!--T:7-->
 
<!--T:8-->
[[File:and_example.gif|alt=And example gif|thumb]]
[[File:and_example.png|alt=And example code|thumb]]
 
<!--T:9-->
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.
 
<!--T:10-->
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.


<!--T:1-->
<!--T:1-->

Latest revision as of 15:27, 14 August 2023

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.