Skip to content

Instantly share code, notes, and snippets.

@ntd251
Last active June 24, 2020 09:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ntd251/f27e86af54d36aacda1065735bb09c0e to your computer and use it in GitHub Desktop.
Save ntd251/f27e86af54d36aacda1065735bb09c0e to your computer and use it in GitHub Desktop.
# Bad
my_long_str = 'Hi, here is ' + name + '.\nThis is my multiline description.\nAnd it is still readable.\nRight?'
# Less Bad
my_long_str =
'Hi, here is ' + name + '.\n' +
'This is my multiline description.\n' +
'And it is still readable.\n' +
'Right?'
# Somewhat better
my_long_str =
'Hi, here is ' + name + ".\n" \
"This is my multiline description.\n" \
"And it is still readable.\n" \
"Right?"
# Good
my_long_str = <<-TEXT
Hi, here is #{name}.
This is my multiline description.
And it is still readable.
Right?
TEXT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment