Procedure: Difference between revisions

From StarLogo Nova Wiki
(updates from Blockument)
(Marked this version for translation)
Line 2: Line 2:
<translate>
<translate>


<!--T:3-->
<section begin="image"/>[[File:procedure.png|alt=The Procedure Block|thumb]]<section end="image"/>
<section begin="image"/>[[File:procedure.png|alt=The Procedure Block|thumb]]<section end="image"/>


==Usage==
==Usage== <!--T:4-->


<!--T:2-->
<!--T:2-->
<p id="tooltip">Defines a grouping of commands to do a particular function. Select “name” and type over it to rename the procedure.</p>
<p id="tooltip">Defines a grouping of commands to do a particular function. Select “name” and type over it to rename the procedure.</p>


==Syntax==
==Syntax== <!--T:5-->


<!--T:6-->
Inputs in this block:
Inputs in this block:
#in the “name” box, enter a name for the procedure
#in the “name” box, enter a name for the procedure
#choose the desired return statement from the drop down menu
#choose the desired return statement from the drop down menu


==Example==
==Example== <!--T:7-->


<!--T:8-->
[[File:procedure_example.gif|alt=Procedure example gif|thumb]]
[[File:procedure_example.gif|alt=Procedure example gif|thumb]]
[[File:procedure_example.png|alt=Procedure example code|thumb]]
[[File:procedure_example.png|alt=Procedure example code|thumb]]


<!--T:9-->
In this version of the snake game, the direction the snake moves is determined by which key is typed. This set of instructions is executed while forever is toggled using the procedure ‘read keyboard input.’
In this version of the snake game, the direction the snake moves is determined by which key is typed. This set of instructions is executed while forever is toggled using the procedure ‘read keyboard input.’



Revision as of 18:44, 14 August 2023

Other languages:
The Procedure Block

Usage

Defines a grouping of commands to do a particular function. Select “name” and type over it to rename the procedure.

Syntax

Inputs in this block:

  1. in the “name” box, enter a name for the procedure
  2. choose the desired return statement from the drop down menu

Example

Procedure example code

In this version of the snake game, the direction the snake moves is determined by which key is typed. This set of instructions is executed while forever is toggled using the procedure ‘read keyboard input.’