Statements

This documentation describes the statements that can be used in KASL.

Declaration Statements

Declaration statements are the statements that can be used in the global scopes.

Global Statements

These are the statements which can be used in the global scope to declare symbols such as variables, structs and functions.

KeywordDescriptionLink
importImports another kasl program.Import
typealiasNames the specific type.Typealias
funcDefines a function.Function
inputDefines an input.Input
outputDefines an output variable.Output
stateDefines a state variable.State
letDefines a global constant.Let
structDefines a struct.Struct
operator infix / prefix / postfixDefines the precedence and the associativity for the operator.Operator Definition
func infix / prefix / postfixDeclares the implementation of an operator for the specific operand types.Operator Function

Struct Statements

Below are the statements can be used inside struct declarations.

KeywordDescriptionLink
varDefines a struct field.Struct Field
funcDefines a member function for the struct.Function

Statements

Statements can be used inside functions, and creates the actual execution logic.

StatementDescriptionLink
{}Creates a scope.Block
varDeclares a local variable.Var
letDeclares a local constant.Let
=Assigns a value to the variable or its field.Assign
if / if-elseConditionally execute the statements.If
returnExits from the function with a return value.Return
loopCreates a loop that will be executed specific times.Loop