Hello. My question is kind of simple, this code doesn’t work
I am implementing fibonacci and I really want it the simplest way possible but this doesn’t seem to work I think because of how live_loop is working. Can anybody give some insight?
Thanks in advance
current = start[0]+start[1]
live_loop :increment do
play current
sleep 0.5
start = [start[1], current]
end
Have a look at the tutorial, chapter 10.1 Set and get, that’s probably what you will want to use.
set :my_var, (ring :c, :d, :e, :f) # set my_var to a ring
live_loop :tune do
play get(:my_var).tick # retrieve my_var
sleep 1
end
You are probably aware of the fact that the use of set and get alone will not make your code work; I assume you deliberately posted just part of it (e. g. start is not initialised and does not have a value). But I think this will get you going…