rubystringnewline

How to add extra newline with 'puts' without sticking newline character into string?


If I say

puts "Hello"

and decide to add an extra newline I need to do this:

puts "Hello\n"

Having this character in the string is ugly. Is there any way to do this without polluting my string?


Solution

  • Just make another call to puts:

    puts "Hello"
    puts