zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

defer_unwind.zig (347B) - Raw


      1 const std = @import("std");
      2 const print = std.debug.print;
      3 
      4 pub fn main() void {
      5     print("\n", .{});
      6 
      7     defer {
      8         print("1 ", .{});
      9     }
     10     defer {
     11         print("2 ", .{});
     12     }
     13     if (false) {
     14         // defers are not run if they are never executed.
     15         defer {
     16             print("3 ", .{});
     17         }
     18     }
     19 }
     20 
     21 // exe=succeed