Now we will take a quick detour away from functions to discuss a concept known as variables. Variables are similar to functions in that they are containers for data. You can use variables to assign a name to a piece of data then when you want to call it you simply type the name. Take a look at the example below:
sample_name = :loop_amen loop_amen_duration = 1.7533 play sample_name sleep loop_amen_duration play sample_name
We have assigned values to each of these variables and then we access those values by calling the variable! In this situation it isn’t very helpful but this is just an example of what you can do.
🌟 Name a variable by typing your_variable_name = and setting it to whatever you want (a particular synth, loop, option, number etc…). Remember that sample names begin with a : (colon)!
It is important to note that you can only access a variable inside of the thread you declare it in. This goes back to the idea of scope and inheritance that we learned about earlier.