Strings In Depth8 / 19
Up next

Strings are byte slices

const std = @import("std");

// take []const u8 so the function accepts any UTF-8 text
fn shout_len(s: []const u8) usize {
    return s.len;
}

pub fn main() void {
    const text: []const u8 = "systems";
    std.debug.print("{d}\n", .{shout_len(text)});
}
What you're solving

[]const u8 is the string type