Example

Arrays using scopes

length, push, pop, indexing, and mutation through a function.

Save this as a .alana file, then alana filename.alana. And start coding cute.

define num[] numbers is [10, 20, 30];

showln length numbers;

push numbers with 40;
push numbers with 50;

showln length numbers;
showln numbers[3];
showln numbers[4];

pop numbers;

showln length numbers;
showln numbers[3];

define func modify(num[] arr);
    push arr with 99;
    showln length arr;
    showln arr[length arr - 1];
    pop arr;
    showln length arr;
end;

call modify(numbers);

showln length numbers;
showln numbers[3];