From: Justin Collins Date: 2006-03-22T02:10:45+09:00 Subject: Re: ! and ? in function name Tony wrote: > Hi Ruby-rulez ! > > I often look at some code, for example un rails/active_record, where > functions name end with a ? or a ! > > Is this a special notation, meaning that the func or args or whatever > have some treatment before/after the body ? Or to show that the function > return a boolean (?) and the arg modified (!) ? > > Thanx ;) Generally the (?) means it returns a boolean and (!) means it modifies the receiver (the object the method is being called on) in place, rather than creating a new object. For example: irb(main):001:0> a = "Hello" => "Hello" irb(main):002:0> a.include?('e') => true irb(main):003:0> a.reverse => "olleH" irb(main):004:0> a => "Hello" #unmodified irb(main):005:0> a.reverse! => "olleH" #modified irb(main):006:0> a => "olleH" Hope that helps. -Justin -- Posted via http://www.ruby-forum.com/.