From: David Alan Black Date: 2002-03-31T09:07:55+09:00 Subject: Re: re-assign variable to another object without causing error message. Hello -- On Sun, 31 Mar 2002, Hubert Hung-Hsien Chang wrote: > I have a loop that will updated a variable whenever there is > a change. But I have found that I am given an error. It runs and the > result is correct but it would like to get rid of the error. After simplifying > the code, the fundamental problem is the following code: > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > m.rb:26: warning: already initialized constant P [...] > P = R > P = P * 2 > > What is the 'correct' way of doing it? Thanks. Use a variable instead of a constant :-) I don't think (?) there's any way not to get warned if you change a constant. David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav