Variable

What is a variable?

Think of a variable as a bucket. You can put values into it and remove values from it. To reference the variable, you must use its name.

Keep in mind that variable values aren't saved, so when the app is closed, they get reset. You can use the SharedPreference block with a ToStringWithoutDecimal block to save their values.

Different kinds of Variables

There are four different kinds of variables in Sketchware:

Boolean

Booleans accept values like true and false

Number

Number variables accept numbers

String

String variables accept a string (text)

Map

Map variables are for making maps with key:value pairs

Blocks

Set Boolean to

Sets a boolean variable to True or False

Set Number to

Sets a number variable to the specified value

Increase 1

Increases the number variable by 1

Decrease 1

Decrease the number variable by 1

Set string to

Sets a string variable to the specified value

Last updated