Hi everyone :)
In c# I can do something like this:
type
State = enum
Corona = 0,
Virus = 1,
All = Corona and Virus
Is it possible in Nim? If yes how to achieve that?
you can use sets for that.
type
State = enum
Corona = 0,
Virus = 1,
const
All = {Corona, Virus}
if Corona in All:
echo "hello"
proc test(x: set[State]) =
echo x == All
var testSet = {Corona}
testSet.incl Virus
test(testSet)
See also the manual for more information: https://nim-lang.org/docs/manual.html#types-set-type