import "std/io"

fun main() {
    test_init_list();
    test();
    println("Done");
}

fun test_init_list() -> [int64] {
    let init_list = new [int64; 5];
    init_list = [1, 2, 3, 4, 5];
    return init_list;
}

fun test() -> int64 {
    let my_list: [int64] = [1, 2, 3, 4, 5];

    let i = 0;
    while i < 5 {
        print("List element: ");
        println(my_list[i] as str);
        i = i + 1;
    }

    let test = test_ret_list();

    let j = 0;
    while j < 5 {
        print("List element: ");
        println(test[j] as str);
        j = j + 1;
    }

    let five = nest_list();
    println(five as str);

    return 0;
}

fun nest_list() -> int64 {
    let my_list: [[int64]] = [[1, 2, 3], [4, 5, 6], [7, 8, 9]];
    print("Nested list element: ");
    println(my_list[2][2] as str);

    return 5;
}

fun test_ret_list() -> [float64] {
    let size = 5;
    let list = new [float64; size];
    list[0] = 2.34;
    list[1] = 3.45;
    list[2] = 4.56;
    list[3] = 5.67;
    list[4] = 6.78;
    return list;
}
