Ad space (banner)
๐ŸŸฃJulia Lessons
Lesson 46 / 68

Multi-line strings (triple quotes)

This lesson covers multi-line strings with Julia's triple quotes, with the aim of building readable messages.

Wrapping text in three double quotes, """, lets you write a string with its line breaks included. It is handy for the body of an email or a long explanation.

The sample code embeds variables with $(name) inside a triple-quoted string and assembles a greeting, a thank-you, and a closing line into one three-line string. Note how the line breaks carry straight into the string.

A common early stumble is where the opening and closing triple quotes sit. Because line breaks and indentation are included as they are, careless layout can introduce whitespace you did not intend.

In professional work, this is used to assemble long text such as an email body, and to lay out HTML or JSON legibly.

๐Ÿ“– Reference code
โœ๏ธ Your code
Type your code, then press "Run"

๐Ÿงช This site can't compile or run Julia directly, so it checks on the spot whether what you typed matches the reference code (scoring happens entirely in your browser โ€” nothing is sent anywhere).

Ad space (banner)
Ad space (in-article)