From: "trans. (T. Onoma)" Date: 2004-11-06T01:24:18+09:00 Subject: Re: value provided for argument with default value - how to check inside method? On Friday 05 November 2004 10:08 am, itsme213 wrote: | "Robert Klemme" wrote | | > I'm unsure what you're at. Normally the idea of having a default value | > is that you don't have to worry about where it came from: | > | > def foo(x=10) | > puts x | > end | > | > Care to unveil a bit more detail why you would need that piece of | > information? | | In this case, I want to use foo() and foo(x) as getter and setter | respectively i.e. some form of overloading. Something like: def foo(*x) if x.empty? defined?(@x) ? @x : @x=10 else @x = x.pop end end Should do the trick. T.