unison/unison-src/transcripts/text-literals.md

42 lines
780 B
Markdown
Raw Permalink Normal View History

2023-03-03 18:02:10 +03:00
```ucm:hide
scratch/main> builtins.merge
2023-03-03 18:02:10 +03:00
```
This transcript shows some syntax for raw text literals.
2023-03-03 18:02:10 +03:00
```unison
lit1 = """
This is a raw text literal.
It can start with 3 or more ",
and is terminated by the same number of quotes.
Nothing is escaped. \n
The initial newline, if it exists, is ignored.
2023-07-21 07:55:12 +03:00
The last line, if it's just whitespace up to the closing quotes,
is ignored.
Use an extra blank line if you'd like a trailing newline. Like so:
2023-03-03 18:02:10 +03:00
"""
> lit1
> Some lit1
2023-03-03 18:02:10 +03:00
lit2 = """"
This is a raw text literal, indented.
It can start with 3 or more ",
and is terminated by the same number of quotes.
Nothing is escaped. \n
2023-03-03 18:02:10 +03:00
This doesn't terminate the literal - """
""""
2023-03-03 18:02:10 +03:00
> lit2
> Some lit2
```
```ucm
scratch/main> add
scratch/main> view lit1 lit2
2023-03-03 18:02:10 +03:00
```