zig

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

destructuring_mixed.zig (369B) - Raw


      1 const print = @import("std").debug.print;
      2 
      3 pub fn main() void {
      4     var x: u32 = undefined;
      5 
      6     const tuple = .{ 1, 2, 3 };
      7 
      8     x, var y : u32, const z = tuple;
      9 
     10     print("x = {}, y = {}, z = {}\n", .{x, y, z});
     11 
     12     // y is mutable
     13     y = 100;
     14 
     15     // You can use _ to throw away unwanted values.
     16     _, x, _ = tuple;
     17 
     18     print("x = {}", .{x});
     19 }
     20 
     21 // exe=succeed