콘텐츠로 이동
Xen / docs

문서 검색

한국어 · v0.1.0-demo.2

검색어를 입력하세요.

    EN
    Xen / examples v0.1.0-demo.2

    문자열과 컬렉션

    문자열과 컬렉션

    저장소나 배포본의 루트에서 실행합니다. xen을 PATH에 추가하거나 ./bin/xen으로 바꾸세요.

    터미널 창
    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));
    }

    파일 다운로드

    터미널 창
    xen build examples/collections.xen -o app

    생성한 실행 파일은 호환되는 Linux에서 실행하세요.