use std.io.printl fn main(){ ; this is a comment ; main is the entry point of every program let nums = 0..31 printl("Here are some even numbers:"..nums.pick(\x x%2==0) to str) return } /. another comment ./ ; loops var sum = 0 do 12 { sum += 1 } check sum==12 ; unit test for elem in 0..4 { ; 0..4: [0,1,2,3,4] printl(elem to str) ; to: converting cast } for e=0,4 { /. same thing ./ } for e=0,8,3 { /. 0 through 8, steps of 3, so [0,3,6] ./ } for val,key in [1,3,5] { ; val,key = 0,1, 1,3, 2,5 } ; types type t {str/i32} ; declare t as either a str or an i32 ; declare a and b as instances of t t a = "this is a string variant" t b = 1337 ; and this is the i32 variant ; matching let f = \x ; lambda, shorthand for fn(var x){...} printl( case x { str s: "we are dealing with a string, namely '"..s.."'!", i32 i: "we are dealing with a 32 bit integer: "..i to str }) match(a) match(b) /. will output: we are dealing with a string, namely 'this is a string variant'! we are dealing with a 32 bit integer: 1337 ./ ; we can also structurally match let {i32/str}[] arr = [ a, "hello world!", "this is not the end", 3434, 0 ] for x in arr { printl( case x { "this" ..rest: "this, followed by '"..rest.."'", "hello"..rest: "hello followed by '"..rest.."'", _ .. "end": "some string ending in 'end'", _ > 5: "something greater than 5", _: "something else" }) } /. will output: this, followed by 'is a string variant' hello followed by 'world!' some string ending in 'end' something greater than 5 something else ./