From: Joel Pearson Date: 2013-01-29T21:19:11+09:00 Subject: Re: Please explain in English Ryan Davis wrote in post #1094171: > This modifies the argument coming in. Don't ever call downcase! or other > mutating methods on an argument or you'll wind up in debugging hell. > Make a copy instead: > > string = string.downcase Ah, I didn't know that a bang method would also change the argument outside of the current scope as well! Dangerous. irb(main):001:0> a = 'a' => "a" irb(main):002:0> def t1(b) irb(main):003:1> b.upcase irb(main):004:1> end => nil irb(main):005:0> def t2(b) irb(main):006:1> b.upcase! irb(main):007:1> end => nil irb(main):008:0> t1 a => "A" irb(main):009:0> a => "a" irb(main):010:0> t2 a => "A" irb(main):011:0> a => "A" -- Posted via http://www.ruby-forum.com/.