Additional output with 'for' loop


Why is the results screen showing the range of numbers I'm outputting as my last result?

for num in 1..20
puts num

Outputs 1 thru 20 but final line is '1..20'



Hey, that happens because methods (functions) in Ruby return some value.
The evaluated expression 1..20, which is a Range, is returned in your case.