corfli
Contents

Start

Language

Project

Basics

A Corfli program runs from the top of main.cfl to the bottom. There is no main function to write.

print("first")
print("second")
first
second

print

print shows its values separated by spaces, then a new line.

age := 15
print("age:", age, true)
age: 15 true

To put values inside text, use { } in a string. See Strings.

Comments

// to the end of the line
/* across
   lines /* and nested */ */
print("ok")
ok

Lines and blocks

A statement ends at the end of the line. To put more than one on a line, separate them with ;:

a := 1; b := 2; print(a + b)
3

A line keeps going when it ends with an operator or inside ( ):

total := 1 +
    2 +
    3
print(total)
6

Blocks use { }. They're required after if, while, for and fn, even for one statement.

Names

Names use letters, digits and _, and can't start with a digit. Letters can be from any alphabet:

שם := "נועה"
print(שם)
נועה

Words that mean something in Corfli (fn, if, int, print, ...) can't be used as names.

Ending the program

The program ends after its last line, with exit code 0. exit ends it early with the code you give:

print("bye")
exit(0)
print("never shown")
bye