Set to: Difference between revisions
(updates from Blockument) |
(Marked this version for translation) |
||
Line 5: | Line 5: | ||
<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> | <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> | ||
==Usage== | ==Usage== <!--T:4--> | ||
<!--T:5--> | |||
Sets the value of a previously existing variable selected from the dropdown menu to the value of the input. | Sets the value of a previously existing variable selected from the dropdown menu to the value of the input. | ||
==Syntax== | ==Syntax== <!--T:6--> | ||
<!--T:7--> | |||
Inputs in this block: | Inputs in this block: | ||
#a previously created variable from the dropdown menu | #a previously created variable from the dropdown menu | ||
#a number in the socket | #a number in the socket | ||
==Example== | ==Example== <!--T:8--> | ||
<!--T:9--> | |||
[[File:set_to_example.gif|alt=Set To example gif|thumb]] | [[File:set_to_example.gif|alt=Set To example gif|thumb]] | ||
[[File:set_to_example.png|alt=Set To example code|thumb]] | [[File:set_to_example.png|alt=Set To example code|thumb]] | ||
<!--T:10--> | |||
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. | 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. | ||
Latest revision as of 19:27, 14 August 2023
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:
- a previously created variable from the dropdown menu
- a number in the socket
Example
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.