Variables

Make a Variable

Variables are made (declared) in the "Global Variables" TAB. If you don't have that TAB then use the "+" to add it to your project. Do not declare the same variable twice because it won't run.

Variable Types:

  • String: "word" or "text" eg 'clicked'
  • Number: mathematical number eg 24
  • Boolean: value can be either "true" or "false" but this is NOT a "string" variable.
  • Array: same as Scratch3 "List"
  • Timer

Set Variable

my_variable = 0

Change Variable

my_variable = my_variable + 1

Variable Example

Declare the two variables used in the "Global Variables" TAB.

Total = 0
for (Counter = 0; Counter < 11; Counter++) {
  console.log(Total)
  Total = Total + 1
  control.wait(1)
}