Skip to content
Xen / docs

Search documentation

English · v0.1.0-demo.2

Type to search the documentation.

    한국어
    Xen / examples v0.1.0-demo.2

    Strings, vectors, views

    Strings, vectors, views

    Run from the repository or distribution root. Put xen on PATH, or substitute ./bin/xen.

    Terminal window
    xen check examples/collections.xen
    xen run examples/collections.xen
    green
    3
    [11, 20]
    20
    collections.xen
    // SPDX-License-Identifier: MIT OR Apache-2.0
    use std.string as text;
    fn main() {
    let words = text.split_ascii_whitespace("red green blue");
    println(words.get(1));
    println("한".len());
    let mut scores: Vec<Int> = [];
    scores.push(10);
    scores.push(20);
    scores[0] = 11;
    println(scores);
    let view = scores.slice(0, 2);
    println(view.get(1));
    }

    Download file

    Terminal window
    xen build examples/collections.xen -o app

    Run the generated executable on a compatible Linux machine.