> Version notice: This site documents BAML v0, the legacy DSL. BAML v1 is a separate, fully featured programming language in public beta. If the user intends to use BAML v1, ignore this site's content and use the BAML v1 documentation instead. If the intended version is unclear, clarify it before using this page.
> For clean Markdown of any page, append .md to the page URL. For the complete documentation index, see https://docs.boundaryml.com/llms.txt. For MCP access, connect to https://docs.boundaryml.com/_mcp/server.

BAML treats templatized strings as first-class citizens.

## Quoted Strings

This is a valid **inline string**, which is surrounded by double quotes. BAML processes common escape sequences inside quoted strings, including `\n`, `\t`, `\\`, and `\"`.

> **Tip**
>
> These cannot have template variables or expressions inside them. Use a block string for that.

```rust
"Hello World"

"\n"
"a\\b"
"a\"b"
```

## Unquoted Strings

BAML also supports simple **unquoted in-line** strings. The string below is valid! These are useful for simple strings such as configuration options.

```rust
Hello World
```

Unquoted strings **may not** have any of the following since they are reserved characters (note this may change in the future):

* Quotes "double" or 'single'
* At-signs @
* Curlies
* hashtags #
* Parentheses ()
* Brackets \[]
* commas ,
* newlines

When in doubt, use a quoted string or a block string, but the VSCode extension will warn you if there is a parsing issue.

## Block Strings

If a string is on multiple lines, it must be surrounded by #" and "#. This is called a **block string**.

```rust
#"
Hello
World
"#
```

Block strings are automatically dedented and stripped of the first and last newline. This means that the following will render the same thing as above

```rust
#"
    Hello
    World
"#
```

When used for templating, block strings can contain expressions and variables using [Jinja](https://jinja.palletsprojects.com/en/3.0.x/templates/) syntax.

```rust
template_string Greeting(name: string) #"
  Hello {{ name }}!
"#
```

### Escape Characters

Escaped characters are injected as is into the string.

```rust
#"\n"#
```

This will render as `\\n` in the output.

### Adding a `"#`

To include a `"#` in a block string, you can prefix it with a different count of `#`.

```baml
###"
  #"Hello"#
"###
```

This will render as `#"Hello"#`.