slige/examples/example_1.slg

26 lines
375 B
Plaintext
Raw Normal View History

2024-12-16 14:12:16 +00:00
fn print(msg: string) #[builtin(Print)] {}
2024-11-01 10:48:21 +00:00
2024-12-09 12:57:48 +00:00
fn sum(a: int, b: int) -> int {
2024-12-12 14:37:56 +00:00
a + b
2024-11-01 10:48:21 +00:00
}
2024-12-10 13:36:41 +00:00
fn main() {
sum(2,3); // -> 5
2024-11-01 10:48:21 +00:00
2024-12-10 13:36:41 +00:00
let a: string = "Hello";
let b = "world";
2024-11-01 10:48:21 +00:00
2024-12-12 14:37:56 +00:00
print(a + " " + b + "!\n"); // -> "Hello world!"
2024-11-01 10:48:21 +00:00
2024-12-12 14:37:56 +00:00
if a == b {
2024-12-17 10:00:14 +00:00
print("Equal\n");
2024-12-10 13:36:41 +00:00
}
else {
2024-12-17 10:00:14 +00:00
print("Unequal\n");
2024-12-10 13:36:41 +00:00
}
2024-11-01 10:48:21 +00:00
2024-12-17 10:00:14 +00:00
for (let i = 0; i < 10; i += 1) {
2024-12-10 13:36:41 +00:00
}
}