long_string = <<EOS
It was the best of times,
It was the worst of times.
EOS
that returns 53. Why? The whitespace counts? Even still. how do we get 53?
How about this?
def test_flexible_quotes_can_handle_multiple_lines
long_string = %{
It was the best of times,
It was the worst of times.
}
assert_equal 54, long_string.size
end
def test_here_documents_can_also_handle_multiple_lines
long_string = <<EOS
It was the best of times,
It was the worst of times.
EOS
assert_equal 53, long_string.size
end
Is this the case because the %{ case counts each /n
as one character and theres considered to be one before the first line, one at the end, and then at the end of the 2nd line, whereas in the EOS
case theres just one before the 1st line and one after the 1st line? In other words, why is the former 54 and the latter 53?