Knowledge Base

Set Variable Block

output-onlinepngtools__231_.png  This block works for both EV3 Robot and Ruby Robot!  output-onlinepngtools__101_.png


The Set Variable block allows you to change the value of a variable that you have already declared. The initial value of the variable is first set by the Declare Variable block

The set variable block is found in the Variables section of the block library. 

To apply the block to a program:

  1. Add a Set Variable block to the program from the block library. 
  2. From the block's drop-down menu, select the desired (previously declared) variable. 
  3. Add a value (data block) to the Set Variable block.

Example Program

In this program, the Set Variable block causes the power of the Drive block to increase by 1 each second (for each iteration of the loop). 


Parameter Description Compatible Blocks Range

Select a previously declared variable.



Changes the value of a variable

All data blocks

-∞ to ∞


See also:

Declare Variable Block 

Variable Block

Was this article helpful?
0 out of 0 found this helpful


Please sign in to leave a comment.