What is the .nil all about?
A quick search yields a bunch of helpful results. This answer seems especially helpful:
The Ruby console doesn’t always print
nilat the end, but it does automatically show the value of the last statement or expression that is executed in your script.
putshappens to return
nil, so if you do
puts "hello", you’ll see
hello, followed by
nil. However, if you say
x = 5, you’ll see
nil, because that’s now the value of the last statement.
- Why is all my code printing nil at the end? It's very foreboding.