I've used SketchUp before, but not with Ruby scripting. I've just tried it out now, and I see the console outputs the return value each time you enter a line (in addition to any puts output). But I can't reproduce exactly what you're seeing.
If I enter each line one at a time, I get 11.0
after the second last line and then this after the last line:
11"
nil
The 'nil' is what #puts
actually returns.
If I save the script in a text editor and load it into SketchUp, I instead get this:
11"
true
'True' is the return value when 'there are no syntax errors in the file' according to the SketchUp documentation.
But as I said, I can't reproduce exactly what you're seeing.
What do you see if you change the last line to just 'distance_x' (delete the word 'puts')? For me, this just returns the value '11.0'.