Get with the name of a variable

As mentioned above, while symbols are nice and short, you can use more than just symbols as the keys to store values against in the time state - you can also use a string, which then allows you to dynamically create the string. So, a small example:

set('c01', 42)
number = '01'
controlPushName = "c#{number}"
puts get(controlPushName)

outputs:
42

(So in a way, it is similar to the dynamic variables idea we discussed over in your previous thread)

1 Like