Strings
A string represents a sequence of characters. We can create a string by enclosing the corresponding sequence of characters between double quotes, as shown in the following:
julia> "Measuring programming progress by lines of code is like measuring aircraft building progress by weight."
If the string also includes quotes, we can escape these by prefixing them with a backslash \
:
julia> "Beta is Latin for \"still doesn't work\"."
Triple-quoted strings
However, escaping can get messy, so there's a much better way of dealing with this—by using triple quotes """..."""
.
julia> """Beta is Latin for "still doesn't work"."""
Â
Â
Â
Â
Â
Â
Within triple quotes, it is no longer necessary to escape the single quotes. However, make sure that the single quotes and the triple quotes are separated—or else the compiler will get confused:
julia> """Beta is Latin for "still doesn't work""""
syntax: cannot juxtapose string literal
The triple quotes come with some extra special powers when used with multiline...