mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
Expand enum example tut1.md (#24268)
I couldn't understand why there is "x" declaration. Comparison make it easier to understand to people not familiar to enums.
This commit is contained in:
@@ -1182,6 +1182,9 @@ at runtime by 0, the second by 1, and so on. For example:
|
||||
|
||||
var x = south # `x` is of type `Direction`; its value is `south`
|
||||
echo x # prints "south"
|
||||
|
||||
if x == Direction.south:
|
||||
echo "It's south!"
|
||||
```
|
||||
|
||||
All the comparison operators can be used with enumeration types.
|
||||
|
||||
Reference in New Issue
Block a user