MACORAONE / DEVELOPER DOCUMENTATION

CMLL Examples

Multiple .cmll examples using the documented current syntax: variables, expressions, conditions, loops, functions and objects.

hello.cmll

Project metadata and output.

# A minimal CMLL program
project "Hello World";
set name = "CMLL";
say "Hello from CMLL!";
show "Language: " + name;
Open .cmll source

variables.cmll

Declarations, arithmetic and string output.

# Variables and arithmetic
set price = 12;
set quantity = 4;
set total = price * quantity;
show "Total: " + total;
Open .cmll source

conditions.cmll

Comparisons and nested if/else.

# Branch on a score
set score = 85;
if score >= 90 {
    say "excellent";
} else {
    if score >= 70 {
        say "good";
    } else {
        say "keep practicing";
    }
}
Open .cmll source

loops.cmll

Array iteration and accumulation.

# Iterate over an array and calculate a total
set total = 0;
for (n in [1, 2, 3, 4, 5]) {
    total = total + n;
}
show total;
Open .cmll source

functions.cmll

Function declarations, calls and return values.

# Functions can return values
func add(a, b) {
    return a + b;
}
set result = add(20, 22);
show result;
Open .cmll source

objects.cmll

Object literals and property access.

# Objects and dot-property access
set user = {
    name: "Dominex",
    active: true,
    tools: ["CMLL", "MacoraOne"]
};
show user.name;
show user.active;
Open .cmll source

Run a program

cmll --version
cmll --help
cmll CMLL-source-codes/examples/hello.cmll

CMLL statements use semicolons because newlines are ignored by the lexer. These examples follow the current language guide; general array indexing is not assumed.

Read the CMLL language guideCMLL repository