I'm working my way through the second edition of the pickaxe and have
encountered an example that doesn't work as I'd expected.

while line = gets
  puts line.downcase
end

That code made sense... it was then simplified to:
puts line.downcase while line = gets

This doesn't work the same, however. I get:
02.07.rb:1: undefined local variable or method `line' for main:Object
(NameError)

The odd part (to me) is that the error isn't spit out until after I've
entered a line. In which order does the interpreter do it's job? Even
more perplexing is:
line = 'This will never be seen...'
puts line.downcase while line = gets

Defining line solves the issue. So, it seems to me, gets is executed
but something is erroring before the assignment to line... ? Any help
in understanding would be greatly appreciated!