I use and work on Java and C#.
I was asked to explain Yield in following Ruby code.
Code:
mine=15
puts "Mine = 15"
def call_block
yield
yield
puts 'Now for some magic!'
end
call_block {mine}
print "Mine now is "
puts mine
Output:
mine = 15
now for some Magic!
mine now is 25
The question is how to get this output using the above code.
I don't know much about yield and that's why not getting the code right.
I think 10 has to be added somewhere but where?
Any help would be much appreciated.