enum Fruit { Apple, Banana, Cherry }
bitflag FileBits { Read, Write, Execute, Reg=128, Block, Dir }
main()
{
assert(Fruit.Apple == 0)
assert(Fruit.Banana == 1)
assert(Fruit.Cherry == 2)
assert(FileBits.Read == 1)
assert(FileBits.Write == 2)
assert(FileBits.Execute == 4)
assert(FileBits.Reg == 128)
assert(FileBits.Block == 256)
assert(FileBits.Dir == 512)
a := Fruit.Apple
b := FileBits.Read
a .= Banana
b .= Read
assert(IsABanana(Banana))
assert(!IsABanana(Cherry))
assert(a < Cherry)
assert(b < Dir)
b .= Read|Execute|Reg
assert(b & Execute)
}
IsABanana(Fruit v) bool { return v == Banana }