mirror of
https://git.sfja.dk/Mikkel/slige.git
synced 2025-01-18 13:06:30 +00:00
33 lines
730 B
Plaintext
33 lines
730 B
Plaintext
//
|
|
|
|
//fn print(msg: string) #[builtin(Print)] {}
|
|
//fn println(msg: string) { print(msg + "\n") }
|
|
//
|
|
//fn itos(number: int) -> string #[builtin(IntToString)] {}
|
|
//
|
|
//fn array_new<T>() -> [T] #[builtin(ArrayNew)] {}
|
|
//fn array_push<T>(array: [T], value: T) #[builtin(ArrayPush)] {}
|
|
//fn array_length<T>(array: [T]) -> int #[builtin(ArrayLength)] {}
|
|
//fn array_at<T>(array: [T], index: int) -> T #[builtin(ArrayAt)] {}
|
|
|
|
|
|
fn main() {
|
|
let strings = array_new::<string>();
|
|
array_push(strings, "hello");
|
|
array_push(strings, "world");
|
|
|
|
let ints = array_new::<int>();
|
|
array_push(ints, 1);
|
|
array_push(ints, 2);
|
|
|
|
for v in strings {
|
|
println(v)
|
|
}
|
|
|
|
for v in ints {
|
|
println(itos(v))
|
|
}
|
|
}
|
|
|
|
|