Wyzer

Knowing yourself is the beginning of all wisdom.

— Aristotle

Variables and Types

Wyzer is statically typed, but the compiler can often infer the type based on the value you assign.

Declaring Variables

You declare variables based on whether their values can change:

fn variables() {
    let x = 5;
    // x = 6; // Error: cannot mutate a `let` binding

    var y = 10;
    y = 20; // Allowed

    const MAX_USERS: u32 = 100;
}

Breaking it down

  • let (Immutable): By default, variables are immutable. You cannot change x after assigning it.
  • var (Mutable): If you need to reassign a variable later, use var.
  • const (Compile-Time Constant): For values that never change, use const. You must explicitly declare the type (e.g., u32).

Primitive Types

Wyzer provides a standard set of numeric and text types:

let count: u32 = 42;
let pi: f32 = 3.14;
let is_active: bool = true;
let letter: char = 'W';
let greeting: str = "Welcome to Wyzer";

Breaking it down

  • Integers: Signed (i8 to i128) and unsigned (u8 to u128). usize depends on your system architecture.
  • Floating-Point: f8, f16, f32, f64, f128.
  • bool: true or false.
  • Text: char for single characters (single quotes) and str for strings (double quotes).

Compound Types

You can group multiple values together:

let coord: (u32, u32) = (10, 20);
let numbers: [u32] = [1, 2, 3];

Breaking it down

  • Tuples ((10, 20)): A fixed-length grouping of potentially different types.
  • Arrays ([1, 2, 3]): A fixed-length collection where every element must have the same type.

© 2026 Wyzer Contributors

Edit this page on GitHub