From: "Matthew, Graeme" Date: 2002-09-19T15:26:52+09:00 Subject: If Statement Help and param passing Thanks Ryan, no wonder I couldnt find any doco :-) doh ! , one more for the day I have noticed that some params in methods / function are passed as follows: object.method(value, *data) is the * character serving a purpose here, eg passing by value rather than reference ? Thanks for all your help ... Graeme Matthew Analyst Programmer Mercer Investment Consulting Level 29, 101 Collins Street, Melbourne, VIC, 3001, Australia Tel - 61 3 9245 5352 Fax - 61 3 9245 5330 visit http://www.merceric.com -----Original Message----- From: Ryan King [mailto:rking@panoptic.com] Sent: Thursday, 19 September 2002 16:22 To: ruby-talk@ruby-lang.org Subject: Re: If Statement Help On 2002.09.19, Matthew, Graeme wrote: > if File.name? > > Can someone please explain the ? usage as I have searched all over the > Pragmatic Programmer pages with no answer. That's just a part of the method name. Run "irb" and paste this into it: class Monkey def hasFleas? true end end class Rking def hasFleas? false end end Monkey.new.hasFleas? Rking.new.hasFleas? You will find that Monkeys have fleas while Rking's decidedly do NOT. Anyway, the point is: Putting a question mark at the end of a method name is a custom to imply that the method returns a boolean. - Ryan __ ********************************************** This e-mail and any attachments may be confidential or legally privileged. If you received this message in error or are not the intended recipient, you should destroy the e-mail message and any attachments or copies, and you are prohibited from retaining, distributing, disclosing or using any information contained herein. Please inform us of the erroneous delivery by return e-mail. Thank you for your cooperation. ********************************************** ec03/04