exercism/zig/resistor-color/resistor_color.zig

22 lines
333 B
Zig

const std = @import("std");
pub const ColorBand = enum(usize) {
black,
brown,
red,
orange,
yellow,
green,
blue,
violet,
grey,
white
};
pub fn colorCode(color: ColorBand) usize {
return @intFromEnum(color);
}
pub fn colors() []const ColorBand {
return std.enums.values(ColorBand);
}