mirror of
https://codeberg.org/ziglings/exercises.git
synced 2026-07-28 10:15:14 +00:00
29 lines
852 B
Diff
29 lines
852 B
Diff
--- exercises/036_enums2.zig 2026-07-21 20:48:50.596099259 +0200
|
|
+++ answers/036_enums2.zig 2026-07-21 20:50:14.726826859 +0200
|
|
@@ -31,7 +31,7 @@
|
|
const Color = enum(u32) {
|
|
red = 0xff0000,
|
|
green = 0x00ff00,
|
|
- blue = ???,
|
|
+ blue = 0x0000ff,
|
|
};
|
|
|
|
pub fn main() void {
|
|
@@ -53,12 +53,12 @@
|
|
\\<p>
|
|
\\ <span style="color: #{x:0>6}">Red</span>
|
|
\\ <span style="color: #{x:0>6}">Green</span>
|
|
- \\ <span style="color: #{}">Blue</span>
|
|
+ \\ <span style="color: #{x:0>6}">Blue</span>
|
|
\\</p>
|
|
\\
|
|
, .{
|
|
- @intFromEnum(Color.red),
|
|
- @intFromEnum(Color.green),
|
|
- @intFromEnum(???), // Oops! We're missing something!
|
|
+ @backingInt(Color.red),
|
|
+ @backingInt(Color.green),
|
|
+ @backingInt(Color.blue), // Oops! We're missing something!
|
|
});
|
|
}
|