📄️ Comments
Comments are ignored by the compiler.
📄️ Literals
A literal is a value written directly in source code. This page covers the syntax for all literal forms in Komplete Script.
📄️ Variables
Use var to declare a variable. Every variable must be initialized at the point of declaration.
📄️ Types
Komplete Script is statically typed. Every value has a type known at compile time.
📄️ Operators
Arithmetic Operators
📄️ Control Flow
if / else
📄️ Optionals
An optional value either contains a value of a given type or is absent. The absence of a value is represented by nil. The type of an optional is written as T?, where T is the underlying type.
📄️ Functions
Functions are named, reusable blocks of code. Declare a function with the fun keyword.
📄️ Classes
A class combines data (properties) and behavior (methods) into a single named type. Use the class keyword to declare one.
📄️ Enumerations
An enumeration defines a finite set of named cases under a common type. Use the enum keyword followed by a name and a list of cases.
📄️ Components
Components are the building blocks of the user interface. Declare a component with the component keyword followed by its name and body.
📄️ Modifiers
A modifier transforms a component, producing a modified version of it. Modifiers are applied to a component using a with block.
📄️ Templates
A template is a deferred block of components. The components inside a template are not created immediately — they are created each time the template is invoked.
📄️ Declarative Control Flow
Component bodies, modifier bodies, and template bodies support a declarative form of if and for. Unlike their imperative counterparts, declarative if and for produce components as output rather than executing side effects — each component expression in the body contributes automatically to the result without any manual accumulation.
📄️ Modules
A module is a single .kscript file. Modules expose symbols through export and consume symbols from other modules through import.