سؤال

proc_obj = -> proto { print proto; puts("World")}

puts proc_obj["Hi"]

puts proc_obj.call("Hello") #Is this is the same as above

please refer me to some link to demystify this ...

هل كانت مفيدة؟

المحلول

What is happening to that lambda is that you're calling its [] method, which causes the lambda to be executed with the argument "Hi". And yes, calling call is the same as calling [].

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top