Answer the question
In order to leave comments, you need to log in
How to pass argument to anonymous function in hash?
There is ruby code
a = {'hello' => proc { |hello| print hello}}
a['hello']('world')
/home/leonid/docs/prog/ruby/trys.rb:2: syntax error, unexpected '(', expecting end-of-input
a['chto-to']('world')
Answer the question
In order to leave comments, you need to log in
a = {'hello' => proc { |hello| print hello } }
a['hello'].call('world') # можно так
a['hello']['world'] # можно так
a['hello'].('world') # можно так
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question