Using the code below:
variable = puts "hello world".upcase
puts "hello world".upcase
You are not assigning a function to a variable.
This is the same as
variable = (puts("hello world".upcase))
It needs to execute
puts to assign the returned value to the variable variable (lol).
This is a way to assign a method to a variable.
puts_method = method(:puts)