initial commit, 4.5 stable
Some checks failed
🔗 GHA / 📊 Static checks (push) Has been cancelled
🔗 GHA / 🤖 Android (push) Has been cancelled
🔗 GHA / 🍏 iOS (push) Has been cancelled
🔗 GHA / 🐧 Linux (push) Has been cancelled
🔗 GHA / 🍎 macOS (push) Has been cancelled
🔗 GHA / 🏁 Windows (push) Has been cancelled
🔗 GHA / 🌐 Web (push) Has been cancelled
Some checks failed
🔗 GHA / 📊 Static checks (push) Has been cancelled
🔗 GHA / 🤖 Android (push) Has been cancelled
🔗 GHA / 🍏 iOS (push) Has been cancelled
🔗 GHA / 🐧 Linux (push) Has been cancelled
🔗 GHA / 🍎 macOS (push) Has been cancelled
🔗 GHA / 🏁 Windows (push) Has been cancelled
🔗 GHA / 🌐 Web (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
enum Flags {
|
||||
FIRE = 1 << 1,
|
||||
ICE = 1 << 2,
|
||||
SLIPPERY = 1 << 3,
|
||||
STICKY = 1 << 4,
|
||||
NONSOLID = 1 << 5,
|
||||
|
||||
ALL = FIRE | ICE | SLIPPERY | STICKY | NONSOLID,
|
||||
}
|
||||
|
||||
|
||||
func test():
|
||||
var flags = Flags.FIRE | Flags.SLIPPERY
|
||||
print(flags)
|
||||
|
||||
flags = Flags.FIRE & Flags.SLIPPERY
|
||||
print(flags)
|
||||
|
||||
flags = Flags.FIRE ^ Flags.SLIPPERY
|
||||
print(flags)
|
||||
|
||||
flags = Flags.ALL & (Flags.FIRE | Flags.ICE)
|
||||
print(flags)
|
||||
|
||||
flags = (Flags.ALL & Flags.FIRE) | Flags.ICE
|
||||
print(flags)
|
||||
|
||||
flags = Flags.ALL & Flags.FIRE | Flags.ICE
|
||||
print(flags)
|
||||
|
||||
# Enum value must be casted to an integer. Otherwise, a parser error is emitted.
|
||||
flags &= int(Flags.ICE)
|
||||
print(flags)
|
||||
|
||||
flags ^= int(Flags.ICE)
|
||||
print(flags)
|
||||
|
||||
flags |= int(Flags.STICKY | Flags.SLIPPERY)
|
||||
print(flags)
|
||||
|
||||
print()
|
||||
|
||||
var num = 2 << 4
|
||||
print(num)
|
||||
|
||||
num <<= 2
|
||||
print(num)
|
||||
|
||||
num >>= 2
|
||||
print(num)
|
Reference in New Issue
Block a user