Strings In Depth5 / 19
Up next

Iterate over bytes

const std = @import("std");

pub fn main() void {
    const s = "zig";
    var upper: u8 = 0;
    // each element is a u8 byte
    for (s) |c| {
        if (c > upper) upper = c;
    }
    std.debug.print("max byte {d}\n", .{upper});
}
What you're solving

for loops over the bytes of a string