Language Reference

This section covers the core building blocks of EZ — everything you need to write programs from simple scripts to larger applications.

What You’ll Learn

EZ is designed to be straightforward. There are no hidden tricks or complex rules to memorize. What you see is what you get.

Topics

TopicWhat it covers
KeywordsReserved words in EZ — temp, const, do, if, etc.
VariablesStoring values with temp and const
FunctionsCreating reusable blocks of code with do
Control FlowMaking decisions with if/otherwise and loops
TypesData types — int, float, string, bool, arrays, maps
StructsGrouping related data together
EnumsDefining a set of named values
ModulesOrganizing code into separate files

Where to Start

New to programming? Start with Variables, then Functions, then Control Flow. These three concepts are the foundation of almost every program.

Coming from another language? Skim through Keywords to see EZ’s syntax, then jump to whatever topic you need.

Quick Example

Here’s a small program that shows several language features:

import @std

// A struct to hold data
const Person struct {
    name string
    age int
}

// A function that uses control flow
do greet(p Person) {
    if p.age < 18 {
        std.println("Hey ${p.name}!")
    } otherwise {
        std.println("Hello, ${p.name}.")
    }
}

do main() {
    // Variables
    temp people [Person] = {
        Person{name: "Alice", age: 25},
        Person{name: "Bob", age: 16}
    }

    // Loop through the array
    for_each person in people {
        greet(person)
    }
}

Output:

Hello, Alice.
Hey Bob!

Next Steps

Pick a topic and dive in: