# {=} (Formula Command)

##### Sample Usage

b) {= 73 / 51; format=$,.2f}

c) {formtext: name=x; default=4} * {formtext: name=y; default=3} = {= x * y}

d) {= 81 >= 23}

## Quick Overview Video

## Settings

Setting Name | Type | Description |
---|---|---|

Positional | formula | The formula. |

format | text | How to format a numeric output of the formula. |

General Command Settings | ||

trim | yes/no/left/right | If `yes` whitespace is removed before and after the command. If `left` , only whitespace to the left is removed. If `right` , only whitespace to the right is removed. |

The Formula Command is a special command in Text Blaze that allows you to use dynamic math, create variables, and utilize variables previously created throughout the snippet.

Also, notice how this command looks slightly different from other commands. It uses an equal sign between the `{}`

instead of a word like the other commands.

Despite the difference in looks, the formula command has the same syntax as other commands. The first setting, a positional setting, takes a Text Blaze formula. The second optional setting, `format`

, allows you to format numeric outputs.

## Blaze Formula Reference

The {=} (Formula Command), {if}, and {repeat} commands, all utilize the **Blaze Formula Syntax** to let you use formulas and calculations as part of your snippets. There are features like predefined functions, lists, regular expressions, and more.

Visit the Blaze Formula Reference page and learn about what's possible.

## Creating Variables With Assignment Mode

The formula command can also be used to create variables which can then be used in your other formulas within the same snippet.

To use it this way put the name of the variable before the formula command's `=`

sign.

When used in assignment mode, the formula command won't display any output.

To learn more about using variables in your snippets, visit the Blaze Formula Reference page.

It's also possible to use the {=} (Formula Command) command in combination with forms and form values.

## Formatting numbers with the `format`

setting

The optional `format`

setting allows you to control how numeric outputs are formatted in formulas. The formatting will attempt to use the user's locale specified in the Text Blaze account settings.

The following described the available options:

`[[fill]align][sign][symbol][0][width][,][.precision][type]`

It is useful to see examples of format definitions and the resulting outputs. The following table shows how different formats would be applied to different sample numbers.

Format | Applied to `0.934` | Applied to `1245.67` |
---|---|---|

s | 934.2m | 1.24567k |

, | 0.9342 | 1,245.67 |

,% | 93% | 124,567% |

+, | +0.9342 | +1,245.67 |

.3r | 0.934 | 1250 |

.3n | 0.934 | 1.25e+3 |

.0f | 1 | 1246 |

.1f | 0.9 | 1245.7 |

.1e | 9.3e-1 | 1.2e+3 |

$,.0f | $1 | $1,246 |