N
Neeraj Kumar
this code is a simplified version of the code I saw in Rails.
def speak(*types,&block)
block.call
end
# I can understand why this code is working
speak(23) { puts 'hi' }
# why this code is working ?. This code should fail because I am not
providing any # param to types. It means block is being passed as the
first param and that's not # good
speak { puts 'hi' }
def speak(*types,&block)
block.call
end
# I can understand why this code is working
speak(23) { puts 'hi' }
# why this code is working ?. This code should fail because I am not
providing any # param to types. It means block is being passed as the
first param and that's not # good
speak { puts 'hi' }