> ## Documentation Index
> Fetch the complete documentation index at: https://gocharting.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# What Lipi does not do

> Names and forms that do not exist in Lipi v2, the compiler's message for each, and what to write instead.

Some names and forms look as though they ought to work, and do not. Each row gives what is written, what the compiler says, and
what to write instead. All of them are refused by the editor's check, except where the row says otherwise.

## Names that do not exist

| Written | The compiler says | Write instead |
| - | - | - |
| `var x = 0`, `varip x = 0` | `` `var` is not a valid type in variable declaration. `` (`varip` likewise; with a type, `var int n = 0`, it is `extraneous input 'n' expecting '='`) | `static int x = 0` keeps a value from bar to bar. `intra` keeps it while one bar is forming and resets it at the next bar. |
| `request.security(...)`, `security(...)` | ``No variable with name `request` found.`` (`security`: ``Function `security` is not available here. Functions must be defined before use, and cannot call themselves.``) | Nothing: a script reads only the symbol and interval of its chart. A previous-day value can be built from the chart's own bars (see [How to work around a name Lipi does not have](https://gocharting.com/docs/scripting/how-to/work-around-a-name-lipi-does-not-have.md)). |
| `matrix.new<float>(2, 2)`, `map.new<string, float>()` | ``No variable with name `matrix` found.`` (`map` likewise) | Arrays, or an array of your own `type`. |
| `syminfo.tickerid` | ``Namespace `syminfo` has no variable `tickerid`. Did you mean `ticker`?`` | [`syminfo.ticker`, `syminfo.symbol`](https://gocharting.com/docs/scripting/reference/variables/syminfo) |
| `barstate.isnewbar` | ``Namespace `barstate` has no variable `isnewbar`. Did you mean `isnew`?`` | [`barstate.isnew`](https://gocharting.com/docs/scripting/reference/variables/barstate) |
| `default_qty_type=strategy.cash` | ``Namespace `strategy` has no variable `cash`.`` | `strategy.fixed` (the default), or pass `qty` to each order; the strings `"cash"` and `"percent_of_equity"` need a price (see [Strategies and backtesting](https://gocharting.com/docs/scripting/strategies/overview.md)). |
| `log.info(...)` | ``No variable with name `log` found.`` | Nothing prints text to a console; show values with `label`, `table` or `plot`. |
| `alert("m", alert.freq_once_per_bar)` | ``No variable with name `alert` found.`` | `alert("m")`: it takes only the message and fires at most once per bar. |
| `import ...`, `export ...`, `library(...)` | `mismatched input '/' expecting '='` (`library`: ``Function `library` is not available here. ...``) | Nothing: a script is one file. |

Habits that have a Lipi spelling (`array.size`, `timeframe.*`, `chart.point`, `plot.style_*`, `color.pink`, `str.format`, `^`, `;`,
`x = if ...`, a function that sets a global, a field read off a call) are in
[Names and conventions](https://gocharting.com/docs/scripting/language/names-and-conventions.md), which holds the full table of them.

```lipi-invalid theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Persistent value")
var count = 0
plot(count)
```

The compiler says: `var` is not a valid type in variable declaration. Write `static int count = 0`.

```lipi-invalid theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
indicator("Other symbol")
other = request.security("AAPL", "D", close)
plot(other)
```

The compiler says: No variable with name `request` found. There is no way to read another symbol or interval.

## Punctuation and operators

| Written | The compiler says | Write instead |
| - | - | - |
| `if c { x := 1 }` | `mismatched input 'x' expecting {'}', NEWLINE}` | A block over several lines (see [Statements and lines](https://gocharting.com/docs/scripting/language/statements-and-lines.md)). |
| `if c` with the statement on the next line, no braces | `no viable alternative at input '\n'` | `if c {` ... `}` |
| `/* note */` | `no viable alternative at input '\n/'` | `//` on each line. |
| `do { ... } while c` | `no viable alternative at input '\n}'` | `while c { ... }` |

## Forms the compiler refuses

| Written | The compiler says | Write instead |
| - | - | - |
| `plot(...)` inside `if`, a loop or a function | `` `plot()` must be called in the global scope. `` (same for `plotshape`, `fill`, `bgcolor`, `barcolor`, `alertcondition`, ...) | Call it at the top level and put the condition in an argument, such as the color. |
| a dot straight after a call: `array.copy(a).length()` (`array.get(a, 0).price` is in [Names and conventions](https://gocharting.com/docs/scripting/language/names-and-conventions.md)) | `extraneous input '.' expecting {<EOF>, NEWLINE}` | A method call needs a variable on its left: `b = array.copy(a)`, then `b.length()`. |
| `plot(a[0])` on an array | ``Cannot call `plot` with argument `series`=`a[0]`. An argument of `series array<float>` type was used but a `series float` is expected.`` | [`array.get(a, 0)`](https://gocharting.com/docs/scripting/reference/functions/array); `[]` on an array is the history operator. |
| `func f(a) => a + 1` | `missing Identifier at ')'` | Every parameter has a type: `func f(float a) => a + 1`. |
| `close[-1]` | `History index must be >= 0. Got -1.` | There is no access to future bars. |
| `c ? a` with no `:` branch | `mismatched input '<EOF>' expecting ':'` | `c ? a : b` |

## Things that look wrong but work

* `ta.sma(...)` and `talib.sma(...)` are the same namespace.
* `and`, `or`, `not` and `&&`, `||`, `!` are the same operators.
* `step` may be a named argument: `input.int(20, "Length", step=5)`.
* A function may be declared with `func` or with no keyword: `half(float a) => a / 2`. (`def` declares a method; see [Your own functions](https://gocharting.com/docs/scripting/language/custom-functions.md).)
* `x == na` compiles but warns; write `na(x)`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.