| ... | @@ -3585,7 +3585,7 @@ const Type = enum { | ... | @@ -3585,7 +3585,7 @@ const Type = enum { |
| 3585 | not_ok, | 3585 | not_ok, |
| 3586 | }; | 3586 | }; |
| 3587 | | 3587 | |
| 3588 | // Declare a specific instance of the enum variant. | 3588 | // Declare a specific enum field. |
| 3589 | const c = Type.ok; | 3589 | const c = Type.ok; |
| 3590 | | 3590 | |
| 3591 | // If you want access to the ordinal value of an enum, you | 3591 | // If you want access to the ordinal value of an enum, you |
| ... | @@ -3634,13 +3634,13 @@ test "enum method" { | ... | @@ -3634,13 +3634,13 @@ test "enum method" { |
| 3634 | try expect(!p.isClubs()); | 3634 | try expect(!p.isClubs()); |
| 3635 | } | 3635 | } |
| 3636 | | 3636 | |
| 3637 | // An enum variant of different types can be switched upon. | 3637 | // An enum can be switched upon. |
| 3638 | const Foo = enum { | 3638 | const Foo = enum { |
| 3639 | string, | 3639 | string, |
| 3640 | number, | 3640 | number, |
| 3641 | none, | 3641 | none, |
| 3642 | }; | 3642 | }; |
| 3643 | test "enum variant switch" { | 3643 | test "enum switch" { |
| 3644 | const p = Foo.number; | 3644 | const p = Foo.number; |
| 3645 | const what_is_it = switch (p) { | 3645 | const what_is_it = switch (p) { |
| 3646 | Foo.string => "this is a string", | 3646 | Foo.string => "this is a string", |