From: Phrogz Date: 2007-08-17T13:45:00+09:00 Subject: Re: Passing two functions as parameters On Aug 16, 8:00 pm, Pe�a, Botp wrote: > [mailto:list-bou...@example.com] On Behalf Of Frank Meyer > i like ruby since it treats vars and methods alike. > > this is just a simple example, > > irb(main):001:0> def x > irb(main):002:1> puts "x" > irb(main):003:1> end > => nil > irb(main):004:0> def y > irb(main):005:1> puts "y" > irb(main):006:1> end > => nil > irb(main):012:0> def test2(a=x,b=y,c=x) > irb(main):013:1> a > irb(main):014:1> b > irb(main):015:1> c > irb(main):016:1> end > => nil > irb(main):017:0> test2 > x > y > x > => nil You may not realize it, but what you just wrote is the same as: def test2( a=x, b=y, c=x ) nil nil nil end The methods are being invoked as the method parameters are being set up, and three nil values (the return value of those methods, which is the return value of their 'puts' calls) are being assigned to your variable. I only point this out since the code sort of implies that the parameter assignments are treating methods as first-class functions, and you are invoking them inside the method.