Skip to content
Aria Ghora Prabono edited this page Oct 8, 2021 · 2 revisions

Welcome to the carrot wiki!

1. Variable

var_name: type = intial_value

Example:

hello: str = "Hello world"
x: int = 1 + 10

2. Branching

if x > 1:
  println("block 1")
elif condition:
  println("block 2")
elif condition:
  println("block 3")
else
  println("Else block")
end

3. Looping

numbers: list = [100, 200, 300]
iter numbers as num, @idx:
  println("Item at index ", idx, " is ", num)
end

Index reference is optional.

iter numbers as num:
  println("Item: ", num)
end

4. Function

Clone this wiki locally