# Vex reference: Formulas

| Name | What |
| --- | --- |
| [`if`](#if) | Picks a value per bar. condition ? a : b is the same. |
| [`starts`](#starts) | What prev(name) reads before there is an earlier bar. |
| [`none`](#none) | No value (an empty bar, no color). |
| [`and`](#and) | Both are true. |
| [`or`](#or) | Either is true. Between texts at the top level, a list of choices for a setting. |
| [`not`](#not) | The opposite yes/no. |

## if

```vex
if condition then a else b
```

Picks a value per bar. condition ? a : b is the same.

**In Pine Script:** `condition ? a : b`

**Example**

```vex
plot(close > open ? high : low)
plot(if close > open then 1 else -1, "Up or down", style = steps)
```

See also: [Picking a value: if and ? :](/documentation/vex/picking-a-value-if-and)

## starts

```vex
name starts value
```

What prev(name) reads before there is an earlier bar.

**In Pine Script:** `var x = value`

**Example**

```vex
n starts 0
n = new_day ? 0 : prev(n) + 1
plot(n, "Bars into the day", style = steps)
```

See also: [Values that carry over: starts](/documentation/vex/values-that-carry-over-starts)

## none

No value (an empty bar, no color).

**In Pine Script:** `na`

**Example**

```vex
plot(close > open ? close : none, style = dots)
```

See also: [Empty values](/documentation/vex/empty-values)

## and

```vex
a and b
```

Both are true.

**Example**

```vex
plot(close)
mark(close > open and volume > sma(volume, 20), where = below, shape = dot)
```

## or

```vex
a or b
```

Either is true. Between texts at the top level, a list of choices for a setting.

**Example**

```vex
plot(close)
mark(new_day or crosses_above(close, ema(close, 50)), where = below, shape = dot)
```

## not

```vex
not a
```

The opposite yes/no.

**Example**

```vex
plot(close)
mark(not (close > open), where = above, shape = dot)
```
