While Toggled: Difference between revisions

From StarLogo Nova Wiki
(Marked this version for translation)
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Category:Interface]]
<languages/>
<translate>
 
<!--T:1-->
<section begin="image"/>
<section begin="image"/>
<section end="image"/>
[[File:While toggled.png|alt=While toggled|thumb]]
<section begin="name" />{{Block|when [▼] toggled}}<section end="name" /> is a code block from the [[Interface]] drawer.
<section end="image"/><p id="tooltip">Executes commands repeatedly while the toggle button widget is turned on. When the toggle button widget is turned off, the commands in this block don’t run. Widgets can be created using the Edit Widgets feature.</p>
 
<!--T:7-->
<section begin="name" />{{Block|while [▼] toggled}}<section end="name" /> is a code block from the [[Interface]] drawer.


<!--T:2-->
==Usage==
==Usage==
<p id="tooltip">{{Block|when [▼] toggled}} executes commands repeatedly while the toggle button widget is turned on. When the toggle button widget is turned off, the commands in this block don’t run. Widgets can be created using the [[Edit Widgets]] feature.</p>
{{Block|while [▼] toggled}} executes commands repeatedly while the toggle button widget is turned on. When the toggle button widget is turned off, the commands in this block don’t run. Widgets can be created using the [[Edit Widgets]] feature.
 
<!--T:8-->
<strong>Note:</strong> It is useful to use the ‘while toggled’ block with the toggle button widget if you want the code to execute multiple times until the widget is toggled off.
 
<!--T:3-->
==Syntax==
[[File:While Toggled Nums.png|right|alt= While Toggled Block|thumb]]
<!-- <code>while [Dropdown: Type of Widget] toggled</code> -->
Input:
#Select the desired toggle-button widget from the drop down menu.
 
==Example== <!--T:9-->
 
<!--T:10-->
[[File:while_toggled_example.gif|alt=While Toggled example gif|thumb]]
[[File:while_toggled_example.png|alt=While Toggled example code|thumb]]


===Syntax===
<!--T:11-->
<code>when [Dropdown: Type of Widget] toggled</code>
When the ‘forever’ button is toggled, the ‘turtle’ agents move forward by one step and turn left by a random number of degrees between -30 and 30 degrees. This allows the agents to wander randomly throughout spaceland.


<!--T:4-->
==Nuances==
==Nuances==
Use this block when you want a stack of code to be continuously executed.
Use this block when you want a stack of code to be continuously executed.


<!--T:5-->
==Related Blocks==
==Related Blocks==
*{{Block|While Toggled|while [▼] toggled}}
*{{Block|When Pushed|when [▼] pressed}}


<!--T:6-->
[[Category:Interface]]
[[Category:Interface]]
[[Category:Code Block]]
[[Category:Code Block]]
</translate>

Latest revision as of 19:21, 11 August 2023

Other languages:


While toggled

Executes commands repeatedly while the toggle button widget is turned on. When the toggle button widget is turned off, the commands in this block don’t run. Widgets can be created using the Edit Widgets feature.

while [▼] toggled is a code block from the Interface drawer.

Usage

while [▼] toggled executes commands repeatedly while the toggle button widget is turned on. When the toggle button widget is turned off, the commands in this block don’t run. Widgets can be created using the Edit Widgets feature.

Note: It is useful to use the ‘while toggled’ block with the toggle button widget if you want the code to execute multiple times until the widget is toggled off.

Syntax

While Toggled Block

Input:

  1. Select the desired toggle-button widget from the drop down menu.

Example

While Toggled example gif
While Toggled example code

When the ‘forever’ button is toggled, the ‘turtle’ agents move forward by one step and turn left by a random number of degrees between -30 and 30 degrees. This allows the agents to wander randomly throughout spaceland.

Nuances

Use this block when you want a stack of code to be continuously executed.

Related Blocks