You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
588 B

# Variables
If you are familiar with some other programming language, the way Sabre handles variables won't surprise you.
To declare a variable, the `let` keyword is used. The type of the variable is infered, but can be specified explicitly.
> **Note**: Type inference currently only works when using the node-backend. For most other backends, the types need to be specified, until proper type inference is implemented.
```
// variables.sb
fn main() {
let x = 10
let y: int = 5
println(x + y)
}
```
Run this code using the sabre CLI:
```
$ sabre run variables.sb
15
```