From: Justin Collins Date: 2008-01-18T06:19:00+09:00 Subject: Re: quick question Ilan Berci wrote: > Johnathan Smith wrote: > >> hey >> >> how do i access i global variable in ruby? >> >> thanks >> > > Trick question! There are no globals in ruby! What do I win? > > ilan > Sorry... Global variables begin with $ irb(main):001:0> def a_method irb(main):002:1> puts $global_var irb(main):003:1> end => nil irb(main):004:0> a_method nil => nil irb(main):005:0> $global_var = "Hi, there. I'm a global" => "Hi, there. I'm a global" irb(main):006:0> a_method Hi, there. I'm a global => nil -Justin