I’m puzzled over the following code:
Proc.new do |a|
a.something "test"
puts a.something
puts "hello"
end
It doesn’t throw any errors when it runs. However nothing is printed for either puts statement. I’m curious about the a.something “assignment”. Perhaps this is a method call w/ parens omitted. What is happening in the above code?
Since the last expression in the proc is
puts, which always returnsnil, the return value of the proc if it is ever invoked will benil.