070_comptime5.patch 523 B

12345678910111213
  1. --- exercises/070_comptime5.zig 2023-10-03 22:15:22.125574535 +0200
  2. +++ answers/070_comptime5.zig 2023-10-05 20:04:07.159435482 +0200
  3. @@ -123,8 +123,8 @@
  4. // Please make sure MyType has both waddle() and quack()
  5. // methods:
  6. const MyType = @TypeOf(possible_duck);
  7. - const walks_like_duck = ???;
  8. - const quacks_like_duck = ???;
  9. + const walks_like_duck = @hasDecl(MyType, "waddle");
  10. + const quacks_like_duck = @hasDecl(MyType, "quack");
  11. const is_duck = walks_like_duck and quacks_like_duck;