Skip to content

Commit

Permalink
Add documentation for explicit string interpolation
Browse files Browse the repository at this point in the history
  • Loading branch information
kellydanma committed Jun 25, 2021
1 parent b932827 commit 009bac4
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions misc_docs/syntax/language_explicit_string_interpolation.mdx
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)

0 comments on commit 009bac4

Please sign in to comment.