# to store a value into a variable
note = 60
play note
# to store many values into a variable
notes_array = [60, 62, 64,72]
play notes_array
sleep 1
# and now a surprise for me concerning the syntax
notes = 60,62,64,72
play notes
sleep 1
play_pattern_timed notes, 1
play notes.choose
sleep 1
play notes[1]
I teach sonic pi some pupils about 12 old and i prefer to use the [] syntax but a pupil tried to separate the values with a comma and learns me it works. funny !
Interesting. I’m not sure if that is standard Ruby syntax as I couldn’t find a reference to it on google. Could be, or could be Sonic Pi parsing of the buffer.
It certainly converts it to an array list, as you can see if you do.
notes = 60,62,64,72
puts notes
which produces
└─ [60, 62, 64, 72]
in the log.
Althoughg it works, I think I would encourage them to use the more usual syntax of