And/es: Difference between revisions

From StarLogo Nova Wiki
(Updating to match new version of source page)
(Updating to match new version of source page)
 
Line 2: Line 2:


<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
<p id="tooltip">Determines if both the first and second inputs are true. If both are true, then returns true; else returns false.</p>
<section begin="image"/>[[File:and.png|alt=The And Block|thumb]]<section end="image"/>
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
==Usage==
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
<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>
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
==Syntax==
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
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
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
==Example==
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
[[File:and_example.gif|alt=And example gif|thumb]]
[[File:and_example.png|alt=And example code|thumb]]
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
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.
</div>
 
<div lang="en" dir="ltr" class="mw-content-ltr">
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.
</div>
</div>


[[Category:Lógica]]
[[Category:Lógica]]
[[Category:Code Block]]
[[Category:Code Block]]

Latest revision as of 16: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

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.