Skip to content

[Syntax lookup] Add doc for string literal syntax #352

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions misc_docs/syntax/language_string_delimiter.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
id: "string-delimiter"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
id: "string-delimiter"
id: "string-literal"

keywords: ["string", "delimiter"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
keywords: ["string", "delimiter"]
keywords: ["string"]

name: "\"\""
summary: "This is the `string` delimiter."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
summary: "This is the `string` delimiter."
summary: "This is the `string` literal syntax."

category: "languageconstructs"
---

The `string` delimiter is composed of two **double** quotes. Single quotes are reserved for the `char` type.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The `string` delimiter is composed of two **double** quotes. Single quotes are reserved for the `char` type.
A `string` literal is composed of two **double** quotes. Single quotes are reserved for the `char` type.


### Example

<CodeTab labels={["ReScript", "JS Output"]}>

```res
let myString = "Single line " ++ "string!"
let myMultiLineString = "Multi
line
string!"
```

```js
var myString = "Single line string!";

var myMultiLineString = "Multi\n line\n string!";
```

</CodeTab>

### References

* [Strings](/docs/manual/latest/primitive-types#string)
* [Characters](/docs/manual/latest/primitive-types#char)