36 lines
552 B
Plaintext
36 lines
552 B
Plaintext
---
|
|
Here is a brief sample of the
|
|
language and its syntax
|
|
---
|
|
|
|
-- Import statements
|
|
import std.collections {
|
|
Heap,
|
|
HashMap,
|
|
}
|
|
|
|
-- Function declaration with types
|
|
fn fizz-buzz(i: Num): Str {
|
|
--- This is technically a legal comment ---
|
|
let fb = "";
|
|
|
|
if i % 3 == 0 {
|
|
fb = fb ++ "fizz";
|
|
}
|
|
|
|
if i % 5 == 0 {
|
|
fb = fb ++ "buzz";
|
|
}
|
|
|
|
if is-empty(fb) {
|
|
return i;
|
|
} else {
|
|
return fb;
|
|
}
|
|
}
|
|
|
|
-- Function declaration without types
|
|
fn main() {
|
|
const fb: Str = fizz-buzz();
|
|
print(fb);
|
|
} |