≈ the.bay.news

The zig doc treats `i += 1` as an expression, but is it?

Ziggit
The zig doc treats `i += 1` as an expression, but is it?
While loops support a continue expression which is executed when the loop is continued. The continue keyword respects this expression. … const expectEqual = @import("std").testing.expectEqual; const expect = @import("std").testing.expect; test "while loop continue expression" { var i: usize = 0; while (i < 10) : (i += 1) {} try expectEqual(10, i); } Here, the doc says (i += 1) is a continue expression.

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.