Lessons

lesson 15 / 15

A complete small script

The following example combines variables, a list, a function, a condition, and a loop without relying on host commands.

kongue
project: "Kongue"
targets:
    - "native"
    - "browser"

func describe {
    if "$1" == "browser" {
        print "$project runs in a sandbox"
    } else {
        print "$project runs with host-provided hooks"
    }
}

main {
    for target in targets {
        describe "$target"
    }
}

The same structure can be extended by a host project. Native tools can provide filesystem and process hooks, while browser tools can keep the safe subset and explain unavailable operations.

Next steps

After this course, read the Kongue manual for the complete syntax reference. Then look at the Kongue-based runFile implementation in kpkg to see how a real project supplies execution hooks and lifecycle functions.