SultanC
  1. Home
  2. Examples
  3. Collections

Creating a vector, appending to it and reading from it

collections/vector.sn
def main(): int {
    let values: mutable vector int = [10, 20];
    append(values, 12);
    return values[0] + values[1] + values[2];
}

Run it

With the interpreter, without compiling:

./build/sultanc run examples/en/collections/vector.sn

Or compile it to an executable:

./build/sultanc examples/en/collections/vector.sn -o build/example && ./build/example

Source on GitHub   All examples