64 lines
1020 B
Plaintext
64 lines
1020 B
Plaintext
use "fmt.cat"
|
|
use lib "directory/long_library_name"
|
|
use "directory/library'with'special'chars"
|
|
|
|
\ This is a comment, it should be ignored by the compiler
|
|
|
|
fmt.printf "%i + %i = %i File length: %i\n" a b a + b (io.file_size "file.txt")
|
|
fmt.println "Hello world!"
|
|
|
|
let a := 123 \ This is another comment, that should be ignored by the compiler
|
|
let uninitialized : u32
|
|
let multiple variables here : u32 = 1 2 3
|
|
let string : str, number : i32
|
|
|
|
if a == 1 {
|
|
lol
|
|
} elif b == 2 {
|
|
kek
|
|
} else {
|
|
aaaaaaa
|
|
}
|
|
|
|
for {
|
|
\ Infinite loop
|
|
}
|
|
|
|
for a > 0 {
|
|
\ Countdown loop
|
|
fmt.printf "%i\n" a--
|
|
}
|
|
|
|
\for let i : i32 = 0; i < 20; i++ {
|
|
\ \ Loop that goes up to 19
|
|
\}
|
|
\
|
|
\for let i : i32 in 0..<20 {
|
|
\ \ Shorthand for above
|
|
\}
|
|
|
|
fn name {}
|
|
fn name returntype {}
|
|
fn name() {}
|
|
fn name(param1 param2 param3: i32, param4: u32) u32 { }
|
|
|
|
struct StructName {
|
|
field1 field2 field3: i32,
|
|
field4: u32,
|
|
}
|
|
|
|
union MyUnion {
|
|
data: StructName,
|
|
some_other_data: EnumName,
|
|
}
|
|
|
|
\enum EnumName {
|
|
\ Value1,
|
|
\ Value2,
|
|
\ Value3,
|
|
\ Value4,
|
|
\}
|
|
|
|
\EnumName.Value1
|
|
|