Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Types

Felico has a static type system that checks types at compile time.

Basic Types

Integers

let x: int = 42

Floats

let pi: float = 3.14159

Booleans

let flag: bool = true

Strings

let message: string = "Hello"

Type Inference

Felico can infer types automatically:

let x = 42        // inferred as int
let name = "Bob"  // inferred as string
let ok = true     // inferred as bool

Type Annotations

You can explicitly annotate types:

let x: int = 42
let y: float = 3.14

Unit Type

Functions without a return value return the unit type ():

fn greet() {
    print("Hello")
}  // returns ()

Coming Soon

  • Custom types (structs, enums)
  • Generic types
  • Type aliases
  • Optional types
  • Result types for error handling

Next Steps