http://www.blitzbasic.com/Community/posts.php?topic=77276#864589
Use the '~' operation, 'Flags:~ FLAG_THREE'.
(You can also use integers for flags and flag holders)
Use the '~' operation, 'Flags:~ FLAG_THREE'.
(You can also use integers for flags and flag holders)
SuperStrict Framework BRL.StandardIO Const FLAG_ONE:Byte = 1, FLAG_TWO:Byte = 2, FLAG_THREE:Byte = 4, FLAG_FOUR:Byte = 8, FLAG_FIVE:Byte = 16 Local Flags:Byte = 0 'Add a flag to a variable Flags:| FLAG_THREE 'Check if a variable contains a flag If Flags & FLAG_THREE Then Print "Hello, flag three!" 'Remove a flag from a variable Flags:~ FLAG_THREE 'Check if a variable contains a flag (again...) If Flags & FLAG_THREE Print "Hello, flag three!" Else Print "Flag three has left! :(" End If Flags:| FLAG_ONE | FLAG_TWO | FLAG_THREE 'Invert flags Local Flags_Inverted:Byte = ~Flags If Flags_Inverted & FLAG_ONE Then Print "ONE is here!" If Flags_Inverted & FLAG_TWO Then Print "TWO is here!" If Flags_Inverted & FLAG_THREE Then Print "THREE is here!" If Flags_Inverted & FLAG_FOUR Then Print "FOUR is here!" If Flags_Inverted & FLAG_FIVE Then Print "Five is here!"