How to avoid last \n character in heredoc
As sagarpandya82 points out, you will need an additional action (i.e. chomp
) to remove that extra \n
.
You can use chomp
along with heredoc like this:
a = <<~TEXT.chomp
asd
asd
TEXT
#=> "asd\nasd"
As sagarpandya82 points out, you will need an additional action (i.e. chomp
) to remove that extra \n
.
You can use chomp
along with heredoc like this:
a = <<~TEXT.chomp
asd
asd
TEXT
#=> "asd\nasd"