summaryrefslogtreecommitdiffhomepage
path: root/CompilerDriver/cc2/regression-tests/pure2-intro-example-hello-2022.cpp2
blob: 9e65338eff7c57e5b65381ad1c2f3ca33647af5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
main: () -> int = {
    vec: std::vector<std::string>
            = ("hello", "2022");

    for vec do (inout str) {
        len := decorate(str);
        print_it(str, len);
    }
}

decorate: (inout thing: _ ) -> int = {
    thing = "[" + thing + "]";
    return thing.ssize();
}

print_it: (x: _, len: _) =
    std::cout
        << ">> " << x
        << " - length "
        << len << "\n";