27
Example 4 : using variables
// The use of 'variables' is something very common in programming languages.
// It adds huge possibilities to the TinyBox.
// There are 3 types of variables:
// - integer ( = numeric )
// - boolean ( = true or false )
// - string ( = text )
// You can recognize a variable by its leading '$' :
VAR $currentBank = 1 // these are integer variables
VAR $currentPreset = 35
VAR $delay = false // this is a boolean variable
VAR $currentSong = “Go with the flow” // this is a string variable
// You can set the value of each variable whenever a certain preset is triggered :
PRESET no_one =
{
$currentSong = “No one knows”
$delay = true
// ...
}
// You can work with integer or boolean values in different ways :
PRESET examples =
{
$curr+ // increment
$currentBank—- // decrement
$curre= 10 // add a constant value
$currentPreset = $curre 5 // calculate
$delay = !$delay // invert a boolean value
}
// The true strength of variables will become clear in the next example,
// covering conditional commands