> I think you're asking how to make the "outside" variable (here, the > "a" Array) a global variable. You need to prefix its name with the "$" > character, i.e. > > class Gate > def update > @state = $a[1].state > end > end > > and > > $a = Array.new > num.times { |i| > $a[i] = Gate.new > etc. > } > > But of course, you really should avoid using global variables if you > can help it. Yes, that is very much what I'm looking for. At this stage it works. Thank you.