# String Interpolation With Quoted Strings

Stapling strings together with the `++` operator can be tedious and clunky. If you have string variables that you'd like to interpolate, you can piece them together much more easily using [quoted strings](https://reasonml.github.io/docs/en/string-and-char.html#quoted-string).

We can get close to a solution with the standard quoted string syntax.

```reason
let greeting = (greetee) => {
  {|Hello, $(greetee)!|}
};

Js.log(greeting("World")); // => "Hello, $(greetee)!"
```

This isn't quite right though. We have to take advantage of a preprocessing hook provided by [Bucklescript](https://bucklescript.github.io/docs/en/common-data-types.html#interpolation). The `j` hook supports unicode and allows variable interpolation.

```reason
let greeting = (greetee) => {
  {j|Hello, $(greetee)!|j}
};

Js.log(greeting("World")); // => "Hello, World!"
```

To use this pre-processor we have to include `j` in the quoted string like so `{j|...|j}`.

See a [live example here](https://reasonml.github.io/en/try.html?reason=DYUwLgBA5gTi4EsB2UIF4IApbzPAlOgHwQDeAUBGQFYA+AEiMMAPYA0EAJNnOAQIS1qAX3LCA3OXIApAM4A6VlB65kygEQB1FjGAATdfnzigA).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ploegert.gitbook.io/til/programmy/ml/reason/string-interpolation-with-quoted-strings.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
