-
-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add documentation for explicit string interpolation
- Loading branch information
1 parent
b932827
commit 009bac4
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
misc_docs/syntax/language_explicit_string_interpolation.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
id: "explicit-string-interpolation" | ||
keywords: ["string", "interpolation"] | ||
name: "``" | ||
summary: "This is the explicit `string` interpolation syntax." | ||
category: "languageconstructs" | ||
--- | ||
|
||
An explicit `string` interpolation is composed of two backticks. It works like JavaScript's backtick string interpolation without the need to escape special characters. | ||
|
||
### Example | ||
|
||
<CodeTab labels={["ReScript", "JS Output"]}> | ||
|
||
```res | ||
let language = "ReScript" | ||
let exclamation = `${language} is pretty cool. | ||
Right? | ||
🎉 | ||
` | ||
``` | ||
|
||
```js | ||
var language = "ReScript"; | ||
|
||
var exclamation = language + " is pretty cool.\nRight?\n🎉\n"; | ||
``` | ||
|
||
</CodeTab> | ||
|
||
### References | ||
|
||
* [String interpolation](/docs/manual/latest/primitive-types#string-interpolation) |