Skip to content

Commit 1308887

Browse files
authored
Merge pull request #352 from kellydanma/syntax_widget/string_delimiter
[Syntax lookup] Add doc for string literal syntax
2 parents 39d5969 + 76d67c5 commit 1308887

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
id: "string-literal"
3+
keywords: ["string"]
4+
name: "\"\""
5+
summary: "This is the `string` literal syntax."
6+
category: "languageconstructs"
7+
---
8+
9+
A `string` literal is composed of two **double** quotes. Single quotes are reserved for the `char` type.
10+
11+
### Example
12+
13+
<CodeTab labels={["ReScript", "JS Output"]}>
14+
15+
```res
16+
let myString = "Single line " ++ "string!"
17+
let myMultiLineString = "Multi
18+
line
19+
string!"
20+
```
21+
22+
```js
23+
var myString = "Single line string!";
24+
25+
var myMultiLineString = "Multi\n line\n string!";
26+
```
27+
28+
</CodeTab>
29+
30+
### References
31+
32+
* [Strings](/docs/manual/latest/primitive-types#string)
33+
* [Characters](/docs/manual/latest/primitive-types#char)

0 commit comments

Comments
 (0)