Examples

Read a few real Kira samples before you dive into a project.

These examples are short on purpose. They make it easy to understand the style and the kind of code you will write day to day.

How to use these examples

Read them in order. The first establishes the smallest working program shape. The second shows how the same syntax style extends into a larger, event-driven app instead of stopping at toy code.

Hello world
kiraHelloKira/Sources/main.kira
@main
function main() {
    print("Hello from Kira")
    return
}

This is the shortest useful mental model: an entry point, one function body, and a print statement. If this reads comfortably, you already understand the tone of the language.

Sokol triangle app
kiraSokolGfxKira/Sources/main.kira
@Main
function main() {
    print("Launching Sokol triangle (pure Kira)...")
    sapp_run(desc: sapp_desc(
        init_cb: on_init,
        frame_cb: on_frame,
        cleanup_cb: on_cleanup,
        width: 800,
        height: 600))
}

The Sokol sample matters because it proves the syntax still holds up when the program stops being tiny. You still read function calls, named arguments, and setup code in a linear way without a huge jump in complexity.

Suggested next steps

After reading these examples, go back to the syntax page to map each construct to its language role, then use the install guide to get a local toolchain ready for your own first program.