Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #2214

Re: Using variables in modules

From Brian Candler <b.candler@pobox.com>
Newsgroups comp.lang.ruby
Subject Re: Using variables in modules
Date 2011-04-03 15:30 -0500
Organization Service de news de lacave.net
Message-ID <99e0c41327bc69f08a043f08d9fd615c@ruby-forum.com> (permalink)
References <1301790250.3173.40.camel@AMD64X2.fritz.box> <20110403103615.1068791b@user-GA-MA785GM-US2H>

Show all headers | View raw


spiralofhope wrote in post #990694:
> On Sun, 3 Apr 2011 09:30:28 +0900
> Stefan Salewski <mail@ssalewski.de> wrote:
>
>>
>> Gravity::G = 9.8102 # we have done a more precise measurement
>>
>> puts Gravity::G
>>
>> works, but gives a warning.
>
> You're not defining a variable.  You're defining a constant with the
> capital G.  Use lowercases and this should work just fine.

Before handing out advice I suggest you test it first. Hint: if you just 
change "G" to "g" in his original code, it will not work.

-- 
Posted via http://www.ruby-forum.com/.

Back to comp.lang.ruby | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Using variables in modules Stefan Salewski <mail@ssalewski.de> - 2011-04-02 19:30 -0500
  Re: Using variables in modules Stefan Salewski <mail@ssalewski.de> - 2011-04-02 19:57 -0500
    Re: Using variables in modules Stefano Crocco <stefano.crocco@alice.it> - 2011-04-03 01:39 -0500
  Re: Using variables in modules Brian Candler <b.candler@pobox.com> - 2011-04-03 02:55 -0500
  Re: Using variables in modules spiralofhope <spiralofhope_rubyml@lavabit.com> - 2011-04-03 12:37 -0500
    Re: Using variables in modules Stefan Salewski <mail@ssalewski.de> - 2011-04-03 15:29 -0500
    Re: Using variables in modules Brian Candler <b.candler@pobox.com> - 2011-04-03 15:30 -0500

csiph-web