From: Jim Freeze Date: 2001-05-24T02:40:50+09:00 Subject: [ruby-talk:15605] Re: How to avoid spelling mistakes of variable names On Thu, 24 May 2001, Dave Thomas wrote: > ndrochak@gol.com (Nick Drochak) writes: > > > Since Ruby does not require a variable to be declared, do people find > > that they often have bugs related to mistyping variable names? > > Actually, this is not quite a true statement. > > The first assignment to a local variable that Ruby sees in a scope > adds that variable to the scope. If you try to use a name isn't a > variable in that scope, or that doesn't correspond to a method, you'll > get a warning: > > > fred = 1 > bert = frde + 1 > #=> > undefined local variable or method `frde' Yes, but this does not help when you mispell the left hand word: fred = 1 betr = fred + 1 Jim ========================================================= Jim Freeze jim@freeze.org --------------------------------------------------------- No comment at this time. http://www.freeze.org =========================================================