Const flag1 = 1 Const flag2 = 2 Const flag3 = 4 Const flag4 = 8 Const flag5 = 16 Const flag6 = 32 Const flag7 = 64 Const flag8 = 128 Dim bitflag As Integer Print "Starting out bitflag is zeros all across" Print "So let's set the fourth Flag. It's value is 8" Print Print "bitflag = bitflag Or flag4" Print Sleep bitflag = bitflag Or flag4 Print "The value of bitflag is now:", bitflag Print Print "Now Let's set the 8th flag also. It's value is" Print "128. The two numbers will be added together." Print "The result will be 128 + 8 = 136" Print Print "bitflag = bitflag Or flag8" Print Sleep bitflag = bitflag Or flag8 Print "The value of bitflag is now:", bitflag Sleep Print Print "Now we are going to see if the 8th and 7th bits are set." Print Sleep If (bitflag And flag8) = flag8 Then Print "Flag 8 is set." Else Print "Flag 8 is not set." EndIf If (bitflag And flag7) = flag7 Then Print "Flag 7 is set." Else Print "Flag 7 in not set." EndIf Print Print "Now we are going to unset bit four. That will set the " Print "value of bitflag to 128." Print Print "bitflag = bitflag And Not(flag4)" Print bitflag = bitflag And Not(flag4) Print "The value of bitflag is now:", bitflag Sleep