Syntax
Variables, functions, and structs stay close to plain language.
Kira is easiest to understand when you see the building blocks side by side. These snippets mirror the style used on the homepage.
Reading Kira in practice
Most of the early syntax is intentionally direct. `let` introduces a value that will not change, `var` introduces one that can, and functions read top to bottom with very little decoration in the common case.
let x: Float = 12
let y = 12.0
var total = x + y
print(total)Use `let` when the value should stay fixed. Use `var` when you plan to update it later. Explicit type annotations are available when they help readability, but simple expressions can often infer their type naturally.
function greet(name: String) {
print("Hello, $name")
return
}Functions declare parameter names and types directly in the signature. The body stays lightweight, which makes small utility functions easy to scan and easy to teach.
@CStruct
type hk_color {
var r: CFloat
var g: CFloat
var b: CFloat
var a: CFloat
}Data types are similarly straightforward. A struct defines its named fields in one place, which helps you move from tiny examples to application code without changing your mental model.