# Choose formatter

> Select one of several outputs based on the value of a placeholder.

Select one of several outputs based on the value of a placeholder.

The Choose formatter adds branching logic to a Smart String: it matches the placeholder value against a set of options and outputs the corresponding choice. Apply it explicitly with the name `choose`.

{ /*  Mermaid source kept for the future doc platform; shown as the static image below until mermaid rendering is supported.  */ }

```mermaid
flowchart TD
    full["{value:choose(1|2|3):one|two|three|default}"]

    full --> p1["value"]
    full --> p2["choose"]
    full --> p3["(1|2|3)"]
    full --> p4["one|two|three"]
    full --> p5["default"]

    p1 --> d1["Any value"]
    p2 --> d2["Formatter name: choose"]
    p3 --> d3["Choices<br/>(pipe-separated list)"]
    p4 --> d4["Outputs<br/>(pipe-separated list)"]
    p5 --> d5["Output if nothing<br/>matched (optional)"]

    classDef code   fill:#F5F5F5,stroke:#BDBDBD,color:#111;
    classDef orange fill:none,stroke:none,color:#F37021;
    classDef green  fill:none,stroke:none,color:#67BC6B;
    classDef pink   fill:none,stroke:none,color:#EB417A;
    classDef purple fill:none,stroke:none,color:#765BA7;
    classDef plain  fill:none,stroke:none,color:#111;

    class full code;
    class p1,d1 orange;
    class p2,d2 green;
    class p3,d3 pink;
    class p4,d4 purple;
    class p5,d5 plain;

    linkStyle default stroke:#2196F3,stroke-width:1.5px;
```


**Anatomy of the choose formatter syntax.:**
![](/api/media?file=/engine/6000.7/media/images/smart-strings-choose-formatter.svg)

The value is converted to a string with [ToString](https://learn.microsoft.com/en-us/dotnet/api/system.object.tostring) and matched against the options, so you can use it on any type, including numbers, booleans, strings, or enums. `null` is also supported.

To supply a fallback output for any values that don't match any of the choices, add an extra output option at the end of the outputs segment.

Choices are case-sensitive by default, but you can configure this behavior with the case sensitivity setting. Refer to [Smart Strings settings reference](/engine/6000.7/manual/scripting/smart-strings/settings.md) for information on the different settings and how to enable them.

| Smart String                                                               | Argument | Result             |
| -------------------------------------------------------------------------- | -------- | ------------------ |
| `{0:choose(1\|2\|3):one\|two\|three\|other}`                               | `2`      | two                |
| `{0:choose(1\|2\|3):one\|two\|three\|other}`                               | `5`      | other              |
| `{0:choose(True\|False):yes\|no}`                                          | `true`   | yes                |
| `{0:choose(null):NULL\|{}}`                                                | `null`   | NULL               |
| `How {0:choose(Male\|Female):is he\|is she\|are they}?`                    | `"Male"` | How is he?         |
| `It is {day:choose(1\|2\|3\|4\|5):Mon\|Tue\|Wed\|Thur\|Fri\|the weekend}.` | `7`      | It is the weekend. |

## Additional resources

* [Conditional formatter](/engine/6000.7/manual/scripting/smart-strings/formatters/conditional-formatter.md)
* [Null formatter](/engine/6000.7/manual/scripting/smart-strings/formatters/null-formatter.md)
* [Smart Strings](/engine/6000.7/manual/scripting/smart-strings.md)
