> For the complete documentation index, see [llms.txt](https://docs.origami.tech/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.origami.tech/reference/grid-language/functions/var.md).

# var()

var() stores a named variable inside a grid. Read it with get(), update it with set() and an optional time-to-live.

The Var function in Origami Tech stores the variables.

## `var`(*name*: *str*, *default*: *decimal*, *cache\_by*: *tuple*=())

Function that is used for holding dynamic variables. Returns object that supports:

`get() -> decimal`

returns value of variable or default if unset

`set(value: decimal, ttl: decimal=inf) -> decimal`

set value to `value` , returns value

`ttl` - optional ttl of variable, default to inf

Examples:

`get` returns 5 if variable unset

Set variable’s value to 10

Example:
