Zig 0.17.0-dev (Split by item)

This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig library itself.

allEqual

Returns true if all elements in a slice are equal to the scalar value provided

mem.allEqual
pub fn allEqual(comptime T: type, slice: []const T, scalar: T) bool

File

lib/std/mem.zig:1183

Code

pub fn allEqual(comptime T: type, slice: []const T, scalar: T) bool {
    for (slice) |item| {
        if (item != scalar) return false;
    }
    return true;
}