Set to

From StarLogo Nova Wiki
Revision as of 19:27, 14 August 2023 by Admin (talk | contribs) (Marked this version for translation)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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.