Or/es: Difference between revisions

From StarLogo Nova Wiki
(Created page with "O")
 
(Updating to match new version of source page)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
<languages/>
<languages/>
<div lang="en" dir="ltr" class="mw-content-ltr">
<section begin="image"/>[[File:or.png|alt=The Or 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 either the first or second input are true. If at least one is true then returns true; else returns 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:or_example.gif|alt=Or example gif|thumb]]
[[File:or_example.png|alt=Or example code|thumb]]
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
In this epidemic model, the trait ‘Had disease’ was created to keep track of all of the agents who had contracted the disease at some point. These agents were tracked on the line graph in purple. The ‘or’ block was used in the if statement so that agents with the color red or the color blue could be specified.
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
<strong>Note:</strong> Because the ‘or’ block has a round peg and the ‘count within’ block used for the line graph only takes inputs with a square peg, it is impossible to simply count agents with ‘color red or blue’ for the line graph. This is why the trait ‘Had disease?’ was created. Now the line graph ‘contracted disease’ series [[Special:MyLanguage/Count Within Steps With =|counts agents within 200 steps with ‘Had disease?’ = 1]].
</div>


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

Latest revision as of 17:01, 14 August 2023

Other languages:
The Or Block

Usage

Determines if either the first or second input are true. If at least one is true then returns true; else returns false.

Syntax

Inputs in this block:

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

Example

In this epidemic model, the trait ‘Had disease’ was created to keep track of all of the agents who had contracted the disease at some point. These agents were tracked on the line graph in purple. The ‘or’ block was used in the if statement so that agents with the color red or the color blue could be specified.

Note: Because the ‘or’ block has a round peg and the ‘count within’ block used for the line graph only takes inputs with a square peg, it is impossible to simply count agents with ‘color red or blue’ for the line graph. This is why the trait ‘Had disease?’ was created. Now the line graph ‘contracted disease’ series counts agents within 200 steps with ‘Had disease?’ = 1.