> 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/function/functions/var.md).

# Var

## <mark style="color:purple;">`var`</mark>(*name*: *str*, *default*: *decimal*, *cache\_by*: *tuple*=())

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

<mark style="color:red;">`get() -> decimal`</mark>

returns value of variable or default if unset

<mark style="color:red;">`set(value: decimal, ttl: decimal=inf) -> decimal`</mark>

set value to `value` , returns value

<mark style="color:red;">`ttl`</mark> - optional ttl of variable, default to inf

Examples:

<mark style="color:red;">`get`</mark> returns 5 if variable unset

Set variable’s value to 10

Example:
