> ## Documentation Index
> Fetch the complete documentation index at: https://help.teable.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Formula Grammar

Formula grammar consists of basic values, field references, operators, functions, and parentheses. After you understand these elements, you can write formulas for calculations, conditions, and text processing.

## Basic Elements

| Element         | Syntax                 | Description                                                             |
| --------------- | ---------------------- | ----------------------------------------------------------------------- |
| String          | `'Hello'` or `"World"` | Text wrapped in single or double quotes                                 |
| Integer         | `123`, `-456`          | A number without a decimal point                                        |
| Decimal         | `12.34`, `-45.67`      | A number with a decimal point                                           |
| Boolean         | `TRUE`, `FALSE`        | A true or false value                                                   |
| Field reference | `{age}`                | A field name wrapped in `{}`. The name must match the actual field name |

## Operators

Operators in formulas are used to connect or compare values:

| Type       | Operators                       |   |    |
| ---------- | ------------------------------- | - | -- |
| Math       | `+`, `-`, `*`, `/`, `%`         |   |    |
| Comparison | `>`, `<`, `>=`, `<=`, `=`, `!=` |   |    |
| Logic      | `&&`, \`                        |   | \` |

## Function Calls

You can call functions within formulas. A function call consists of a function name, a pair of parentheses, and parameters inside the parentheses. Parameters are separated by commas.

For example, `sum(1, 2, 3)` calls the `sum` function with three parameters: 1, 2, and 3.

## Other Structures

| Structure                  | Description                                                         |
| -------------------------- | ------------------------------------------------------------------- |
| Parentheses                | Change operation precedence, such as `(1 + 2) * 3`                  |
| Comments                   | Add context. Block comments use `/* */`, and line comments use `//` |
| Whitespace and line breaks | Usually ignored, but they can make formulas easier to read          |
