slige/examples/array_set.slg

24 lines
871 B
Plaintext
Raw Normal View History

2024-12-16 13:37:24 +00:00
fn print(msg: string) #[builtin(Print)] {}
fn println(msg: string) { print(msg + "\n") }
fn int_to_string(number: int) -> string #[builtin(IntToString)] {}
fn string_push_char(str: string, value: int) -> string #[builtin(StringPushChar)] {}
fn string_length(str: string) -> int #[builtin(StringLength)] {}
fn string_to_int(str: string) -> int #[builtin(StringToInt)] {}
fn array_new_string() -> [string] #[builtin(ArrayNew)] {}
fn array_new_int() -> [int] #[builtin(ArrayNew)] {}
fn array_push_string(array: [string], value: string) #[builtin(ArrayPush)] {}
fn array_push_int(array: [int], value: int) #[builtin(ArrayPush)] {}
fn array_length_string(array: [string]) -> int #[builtin(ArrayLength)] {}
fn array_length_int(array: [int]) -> int #[builtin(ArrayLength)] {}
fn main() {
let array = array_new_int();
array_push_int(array, 22);
array[0] = 5;
}