aboutsummaryrefslogtreecommitdiff
path: root/doc/langref/defer_unwind.zig
blob: 65fe11015bcd42a16429f4e4cb7220f15bad1553 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const std = @import("std");
const print = std.debug.print;

pub fn main() void {
    print("\n", .{});

    defer {
        print("1 ", .{});
    }
    defer {
        print("2 ", .{});
    }
    if (false) {
        // defers are not run if they are never executed.
        defer {
            print("3 ", .{});
        }
    }
}

// exe=succeed