# Types and qualifiers

> The types Pine values have, and the qualifiers (const, input, simple, series) that say when a value is known. Why some arguments refuse a series.

Every value in Pine has a **type** (what it is) and a **qualifier** (when it is known). Most of the time Pine works both out for you; you only meet them in error messages, or when a function insists on a value that does not change.

## Types

| Type | Holds | Example |
| --- | --- | --- |
| `int` | Whole numbers | `14`, `bar_index` |
| `float` | Decimals | `close`, `1.5` |
| `bool` | `true` or `false` | `close > open` |
| `string` | Text | `"EMA"` |
| `color` | A colour | `color.teal`, `#8b7cff` |
| `label`, `line`, `box`, `table`… | An id for a drawing | the result of `label.new(...)` |
| `array<float>`, `matrix<int>`, `map<string, float>` | Collections | see [Arrays, matrices and maps](/docs/collections) |
| Your own types | Fields you define | see [Objects and enums](/docs/objects) |

`na` is a value of any type that means "no value". `int` mixes freely with `float`.

## Qualifiers, from strictest to loosest

| Qualifier | Known | Example |
| --- | --- | --- |
| `const` | When the script is written | `20`, `"title"` |
| `input` | When settings are applied | `input.int(20)` |
| `simple` | On the first bar, then fixed | `syminfo.mintick` |
| `series` | Can change on every bar | `close`, `ta.rsi(close, 14)` |

A function argument documented as `simple int` accepts a const, input or simple value, but not a series. This is why some lengths cannot vary per bar.

```pine
//@version=6
indicator("Qualifiers")
len = input.int(14, "Length")      // input int: fine as a length
r = ta.rsi(close, len)              // series float
plot(r, "RSI", color = color.purple)
```

## Declaring with a type

Type keywords are optional; add one when a variable starts as `na`, so Pine knows what it will hold:

```pine
float lastHigh = na
var label tag = na
```

## Converting

`int(x)` truncates a float, `float(x)` widens an int, `str.tostring(x)` makes text. Use `math.round(x)` rather than `int(x)` when you mean "nearest".
