Conventional string literals



Conventional string literals are enclosed in double quotes (
"
).
They support the same escape sequences as in C++ programming language (
\n
,
\t
, etc.).


Raw string literals



Raw string literals are enclosed in paired single quotation marks: characters
and
.
How to type this symbols see here.
Alternatively, if you still have difficulty typing these characters, you can type the digraphs
'"
and
"'
instead of the paired single quotes. Note, however, these digraphs are not part of the 11l language. They exist only for ease of typing, and they will be replaced by
and
in your source 11l file at the lexical analysis stage.

If raw string should contains unpaired single quotation marks, then balancing of raw string should be performed like as for raw HTML in pq markup (see Advanced formatting. Raw HTML).
For example, there is a string
don’t
.
It contains unpaired closing single quotation mark. Let's add a balancing opening single quotation mark at the beginning of the string: don’t.
Enclose that balanced string in single quotation marks: ‘don’t.
Now we need to somehow show to the parser that single quotation mark at the beginning of the string is not a part of the raw string [it is needed only for balancing]. For this purpose typewriter apostrophe
'
is used: one apostrophe absorbs one single quotation mark. In our case one apostrophe should be added at the beginning of the string:
'‘‘don’t’
.
Any balanced string (e.g.
'‘‘don’t’
) can be put inside another raw strings as is:
‘text = '‘‘don’t’’
.


Indented multi-line string literals



Like in such languages as Swift and Julia multi-line string literals in 11l can be indented to match the surrounding code.
[Note, that in Swift and Julia they work slightly differently: {}]

Just prepend string literal with
|
:
V str = |‘First line.
          Second line.’
This is equivalent to
V str = "First line.\nSecond line."


Zero indented multi-line string literals



Python11l
pqmarkup.py
if args_output_html_document:
    args_outfile.write('''\
<html>
<head>
...
''')
I args_output_html_document
   args_outfile.write(\/‘
<html>
<head>
...
’)
cut_copy_paste_tests.py
...:
        tests = """\
(1)
1. Select THIS
...
"""
...
      V tests = \/‘
(1)
1. Select THIS
...
’

Note that
\/"..."
makes no sense, as you can write:
tests = "\
...
"
And
\/‘...’
is needed, as there is no
"""..."""
in 11l, but multi-line string literals often need inner double quotes.