Skip to content

Commit badf8d8

Browse files
authored
Merge pull request #368 from kellydanma/kelly/char_literal_syntax_lookup
[Syntax lookup] Add doc for `char` literal syntax
2 parents f8e82b9 + 3d8f1e5 commit badf8d8

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed
+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
id: "char-literal"
3+
keywords: ["char"]
4+
name: "' '"
5+
summary: "This is the `char` literal syntax."
6+
category: "languageconstructs"
7+
---
8+
9+
A `char` literal is composed of two **single** quotes. Double quotes are reserved for the `string` type. Note that `char` doesn't support Unicode or UTF-8.
10+
11+
### Example
12+
13+
<CodeTab labels={["ReScript", "JS Output"]}>
14+
15+
```res
16+
let one = '1';
17+
let upperCaseA = 'A';
18+
let lowerCaseA = 'a';
19+
```
20+
21+
```js
22+
var one = /* '1' */49;
23+
24+
var upperCaseA = /* 'A' */65;
25+
26+
var lowerCaseA = /* 'a' */97;
27+
```
28+
29+
</CodeTab>
30+
31+
### References
32+
33+
* [Characters](/docs/manual/latest/primitive-types#char)
34+
* [Strings](/docs/manual/latest/primitive-types#string)

0 commit comments

Comments
 (0)