# case

### Description

The resulting value will be based on a range of conditions, which are defined on separate `case...when` lines. Using `else`, describe what value should be assigned when none of the previous conditions is met. The expression has to end with the keyword `end`.

This operator is often used for [calculated information](broken://pages/-ML71u0p4UUNJ6GTeFl0).

### Syntax

```
case
    when [condition_1] then [expression_1]
    ...
    when [condition_n] then [expression_n]
    else [else_expression]
end
```

* all conditions needs to evaluate to either true or false. Examples could be a comparison (`p.age >= 18`) or a yes/no question (`p.has_insurance`).
* All expressions needs to return the same type of value, e.g. a number.

### Example

```
p is Person
case
    when
    p.aum < 100000 then low
    when
    p.aum < 200000 then mid
    else high
end
```

Here, several ranges are defined for how to qualify a person's total value in assets under management (aum). This can impact the services offered to the client.

When the value is under 100.000, the qualifier 'low' is attached to it. For values between 100.000 and 200.000, the qualifier is 'mid'. Else, meaning: every other value of 200.000 and over, the qualifier is 'high'.

Feel free to add as many steps between the low and high extreme as needed.


---

# 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://docs.atfinity.io/rule-language/conditional-expressions/case-when-end.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.
