Set to/es: Difference between revisions

From StarLogo Nova Wiki
 
(Updating to match new version of source page)
 
(2 intermediate revisions 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:set_to.png|alt=The Set To Block|thumb]]<section end="image"/><p id="tooltip">Sets the selected variable to a given value.</p>
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
==Usage==
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
Sets the value of a previously existing variable selected from the dropdown menu to the value of the input.
</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 previously created variable from the dropdown menu
#a number in the socket
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
==Example==
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
[[File:set_to_example.gif|alt=Set To example gif|thumb]]
[[File:set_to_example.png|alt=Set To example code|thumb]]
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
The code above makes use of variables to draw stripes across the screen. Since the value of the variable needs to change in order to change the location of the agent drawing the stripes, the ‘set to’ block is used to set the variable to the current y-value of the agent.
</div>
<div lang="en" dir="ltr" class="mw-content-ltr">
[[Category:Variables]]
[[Category:Variables]]
[[Category:Code Block]]
[[Category:Code Block]]
</div>

Latest revision as of 20:13, 14 August 2023

Other languages:
The Set To Block

Sets the selected variable to a given value.

Usage

Sets the value of a previously existing variable selected from the dropdown menu to the value of the input.

Syntax

Inputs in this block:

  1. a previously created variable from the dropdown menu
  2. a number in the socket

Example

Set To example gif
Set To example code

The code above makes use of variables to draw stripes across the screen. Since the value of the variable needs to change in order to change the location of the agent drawing the stripes, the ‘set to’ block is used to set the variable to the current y-value of the agent.