22 lines
404 B
Zig
22 lines
404 B
Zig
const expect = @import("std").testing.expect;
|
|
|
|
test "for" {
|
|
//character literals are equivalent to integer literals
|
|
const string = [_]u8{ 'a', 'b', 'c' };
|
|
|
|
for (string, 0..) |character, index| {
|
|
_ = character;
|
|
_ = index;
|
|
}
|
|
|
|
for (string) |character| {
|
|
_ = character;
|
|
}
|
|
|
|
for (string, 0..) |_, index| {
|
|
_ = index;
|
|
}
|
|
|
|
for (string) |_| {}
|
|
}
|