aboutsummaryrefslogtreecommitdiff
path: root/test/cases/conditional_branches.1.zig
blob: f402cd3bd499e99f79844f2dece95b9dabcd11dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
extern "c" fn write(c_int, usize, usize) usize;

pub fn main() void {
    foo(true);
}

fn foo(x: bool) void {
    if (x) {
        print();
        print();
    } else {
        print();
    }
}

fn print() void {
    const str = "Hello, World!\n";
    _ = write(1, @intFromPtr(str.ptr), ptr.len);
}

// run
//
// Hello, World!
// Hello, World!
//