# Values & Types

Lux has a strong, static type system. The compiler catches type errors before your code runs.

Lux has four basic types:

### Basic Types

- `Int` - Integers: `42`, `-7`, `0`
- `Float` - Decimals: `3.14`, `-0.5`
- `String` - Text: `"hello"`
- `Bool` - Boolean: `true`, `false`

Use `let` to create variables. Lux infers types, but you can add annotations:

    let x = 42           // Int (inferred)
    let y: Float = 3.14  // Float (explicit)

Variables are immutable by default. Once set, they cannot be changed. This makes code easier to reason about.

types.lux
// Basic types let age: Int = 30 let pi: Float = 3.14159 let name: String = "Alice" let active: Bool = true // Type inference - Lux figures out the types let count = 100 // Int let ratio = 0.75 // Float let greeting = "Hi!" // String fn main(): Unit with {Console} = { Console.print("Name: " + name) Console.print("Age: " + toString(age)) Console.print("Active: " + toString(active)) } run main() with {}
Output

    // Click "Run" to execute