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

# Script language basics

> Syntax for values, collections, assignment, functions, conditions, loops, and errors

Neuron Script is expression-oriented: statements evaluate to values, and collections participate in vectorized mathematical operations.

## Primitive values

```text theme={null}
42
3.14159
1.2e-3
true
false
"text"
'also text'
null
```

The engine also supports big integers, rational and complex numbers, dates and times, physical quantities with units, XML, and .NET objects supplied by the host.

## Assignment

Use `:=` to assign:

```text theme={null}
Name:="Ada";
Retries:=3;
Enabled:=true;
```

Assignment returns the assigned value. Keep side effects on their own lines in shared scripts.

## Collections

```text theme={null}
Vector:=[1,2,3,4];
Matrix:=[[1,2],[3,4]];
EmptyObject:={};
EmptyObject["key"]:="value";
```

Ranges and comprehensions make data pipelines concise:

```text theme={null}
Squares:=[x^2:x in 1..10];
EvenSquares:=[x in Squares:x mod 2=0];
```

## Functions and lambdas

```text theme={null}
Square(x):=x^2;
Square(9)
```

Canonical extensions let functions apply across vectors and other algebraic structures when their implementation supports it. Test the shape of returned values instead of assuming every scalar function vectorizes.

## Conditions

All of these return values:

```text theme={null}
if Temperature>30 then "hot" else "normal"

Temperature>30 ? "hot" : "normal"

PossiblyNull ?? "fallback"
```

Keywords such as `IF`, `THEN`, and `ELSE` are case-insensitive.

## Iteration

```text theme={null}
Sum:=0;
for i:=1 to 10 do
  Sum:=Sum+i;
Sum
```

```text theme={null}
Names:=[];
foreach User in Users do
  PushLast(User.UserName,Names);
Names
```

The language also supports `while`, `do/while`, `break`, `continue`, `return`, and `try/catch/finally` forms.

## Pattern matching

Assignment can destructure values and XML patterns. Treat a failed match as a normal branch in parsers, and validate input before using values in a database statement or .NET call.

## Comments and formatting

Use comments to explain policy and non-obvious constraints, not direct translations of the next expression. Terminate statements with semicolons when a newline could be ambiguous.

## Namespaces and .NET

Script can reference discovered .NET namespaces and types, call static methods, create objects, access properties, and use operators supplied by objects. This is powerful but tightly couples a script to loaded assemblies. Package reusable functionality as a named Script function when you need a stable interface.
