In Python, for example, one can break line with '\' character (yeah, necessary evil). Is it possible to break lines in Elixir?
Sentences, entries, phrases, and clauses that continue in Area B of subsequent lines are called continuation lines. A hyphen in a line's indicator area causes the first nonblank character in Area B to be the immediate successor of the last nonblank character of the preceding line.
Inserting a newline code \n , \r\n into a string will result in a line break at that location. On Unix, including Mac, \n (LF) is often used, and on Windows, \r\n (CR + LF) is often used as a newline code.
The <br> HTML element produces a line break in text (carriage-return). It is useful for writing a poem or an address, where the division of lines is significant.
You cannot split a statement into multiple lines in Python by pressing Enter . Instead, use the backslash ( \ ) to indicate that a statement is continued on the next line. In the revised version of the script, a blank space and an underscore indicate that the statement that was started on line 1 is continued on line 2.
Elixir is not as whitespace-sensitive as Python, so you can do things like:
a =
2 + 4 +
3
# a is bound to 9
If you want to break strings, probably your best shot is to concatenate one string per line:
"this is a very long string that " <>
"spans multiple lines because man, " <>
"is it long"
Based on Jose Valim comment.
iex(1)> "hello\
...(1)> world"
"helloworld"
iex(2)>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With