Logo

Programming-Idioms

  • Python
  • JS
  • Elixir
s = """
multiline
heredoc
"""

Triple-quotes starts a heredoc.
s = ~S"""
This will print multiline
and escape char like \G
"""

s = "Spanning
string
works"
s = """Huey
Dewey
Louie"""
s = ('line 1\n'
     'line 2\n'
     'line 3\n'
     'line 4')

"... String literals that are part of a single expression and have only whitespace between them will be implicitly converted to a single string literal."
let s = `This is a very long string which needs 
to wrap across multiple lines because 
otherwise my code is unreadable.`;

ES6 template literals
let s = "This is a very long string which needs \
to wrap across multiple lines because \
otherwise my code is unreadable.";

When using backslashes, indentation inside the string literal must be far left.
let s = "This is a very long string which needs \n" +
        "to wrap across multiple lines because \n" +
        "otherwise my code is unreadable.";

By concatenation.
s : String := "Will this compile? " &
     "Oh yes it will";

I'm assuming this is what is meant by "consisting in several lines of text."

Use New_Line for line feeds.

New implementation...