1. 17
  1. 7

    You can now do numeric for loops in Zig as well:

    for (0..10) |i| {}
    

    Previously this could only be done with a while loop:

    var i: usize = 0;
    while (i < 10) : |i += 1| {}
    
    1. 1

      This is great! Multi-collection iteration is a powerful feature, and was always one of the neater aspects of Higher Order Messaging, where it falls out naturally from taking the focus away from the iteration and placing it on the thing you are doing:

      a := [ '1.','2.','3.','4. ]
      b := [ 'hello', 'there', 'what''s', 'up' ]
      combined := a collect , b each
      

      result:

      ( "1.hello","2.there","3.what's","4.up")
      
      1. 1

        list.sort(TagSort{ .tags = list.items(.tag) });

        I’m not very familiar with Zig, but how does this work? Isn’t list.items(.tag) pointing inside list, which gets modified inside the sort? Edit: Oh, it works precisely for that reason.