docs
Language Structure
Loops

Intro

Loops can execute a block of code as long as a specified condition is true.

Syntax

subiramo_niba (condition) {
  # code block to be executed
}

Example

reka x = 0
subiramo_niba (x < 100) {
  x = x + 1
  tangaza_amakuru(x)
}

Those codes will print 1, 2, 3, ..., 98, 99, 100

A condition can be as complicated as you want!

Stopping a loop with hagarara

Inside subiramo_niba, write hagarara to leave the loop immediately. A semicolon after it is optional. This is a keyword (break), not hagarara(0) to stop the Kin process.

reka i = 1
subiramo_niba (i <= 100) {
  tangaza_amakuru(i)
  niba (i == 5) {
    hagarara
  }
  i = i + 1
}

This prints 1, 2, 3, 4, 5 and then stops.

Skipping an iteration with komeza

Inside subiramo_niba, write komeza to skip the rest of the current iteration and check the condition again. A semicolon after it is optional. komeza is only valid inside a loop (not inside a function that is merely called from a loop).

reka i = 0
subiramo_niba (i < 5) {
  i = i + 1
  niba (i == 3) {
    komeza
  }
  tangaza_amakuru(i)
}

This prints 1, 2, 4, 5 (3 is skipped).