Blitz3D Docs -> 2D - A-Z -> N -> Not
Not
Parameters:
None.Description:
The NOT operator is used to determine if a condition is FALSE instead of TRUE. This is frequently used in WHILE loops and IF statements to check for the NON-EXISTANCE of an event or value. We use NOT frequently in our examples, inside WHILE loops to test if the ESC key has been pressed.See also: And, Or, Xor.
Example:
; NOT example ; Loop until they press ESC While Not KeyHit(1) ; As long as ESC isn't pressed ... Print "Press ESC to quit!" Wend
Comments
| ||
| how about an "End" statement after the Wend loop |
| ||
| why? |
| ||
| NOT does not seem to work for boolean maths here. You can use the operator ~ instead ! To erase a bit from a variable, you normally would do this: b=a and not(128) ; for example In Blitz you need to do it this way: b=a and ~(128) Well, as the name suggests, it does NOT work, at least not always as expected ;) |
| ||
| There are two NOT operators, both of which operate on 32-bit integer values. The ~ operator is bitwise, it flips every bit. The Not operator is logical. Not( 0 ) is 1 and Not( any nonzero ) is 0. The other boolean operators ( And, Or, Xor ) are all bitwise. |
| ||
| You are in the Blitz3D manual, not in the BlitzMax manual. There is only one NOT operator in Blitz3D, and it's bitwise, not logical. What confuses so many people is that "Not"s is bitwise in Blitz3D, but is logical in BlitzMax (where the bitwise not operator is '~') |
| ||
| There are two not operators in every version of Blitz. The ~ one is bitwise. I don't think ~ gets mentioned anywhere in the Blitz3D docs except that it appears in the operator precedence table. |
| ||
| Dammit I just checked with v1.98 and you're right. When did the change happen?!? I'm pretty sure it was as I mentioned in earlier versions. Or was it only "and" and "or" that changed from logical to bitwise (from BB to BMX) ? Thinking about it, that must be the case. It's so illogical to have only bitwise "and" and "or" operators but to have in the same time both bitwise and logical "NOT", that I must have made a wrong assumption (not to mention many people in the past proved to be confused by the bitwise->logical changed). My Bad. |
| ||
| And/Or/Xor have changed: bitwise prior to BlitzMax. The Not operators have always been the way they are now. The traditional source of confusion was that expressions such as (x>y) produce only 0,1 as the result. When dealing with 0,1 bitwise and logical are the same thing. |
| ||
| And/Or/Xor have changed: bitwise prior to BlitzMax. I know. When dealing with 0,1 bitwise and logical are the same thing This too. The Not operators have always been the way they are now This is the part I overlooked. |
| ||
| I don't think ~ gets mentioned anywhere in the Blitz3D docs except that it appears in the operator precedence table. Why the hell did Mark Sibly never document this operator? I've been using Blitz3D for 8-10 years and this is the first I've heard that that particular operator even exists. |
Blitz3D Manual Forum
BlitzPlus Equivalent Command




