In method call you can omit parenthnes. So this is equivalent to
def world()
print('world!')
end
def aaa (string, method)
print(string)
end
aaa ('hello', world())
On Fri, May 18, 2012 at 05:10:14PM +0900, Robinson Risquez wrote:
> Hi, I was experimenting with the arguments of the methods and I have a
> question:
>
> As I can pass a method as an argument to another method?, For example:
>
>
> def world
> print 'world!'
> end
>
> def aaa (string, method)
> print string
> end
>
> aaa ('hello', world)
>
>
> When I invoke aaa, the method world should not be invoked because I'm
> just passing it as argument and and neither I invoke this in the method
> aaa, and yet it invokes!. Why is this?.
>
> I welcome your support!. Sorry for bad english :)
>
> --
> Posted via http://www.ruby-forum.com/.
--
Electrical conduits in machine room are melting.
-- You received this message because you are subscribed to the Google Groups
ruby-talk-google group. To post to this group, send email to
[email protected]. To unsubscribe from this group, send email
to [email protected]. For more options, visit this
group at https://groups.google.com/d/forum/ruby-talk-google?hl=en