Hi everyone,
this is just a very simple question,
my main compiler is PBP3 Pro, and I'm use to this operator condition (<> or !=Not Equal)
but in GCStudio it's read as "=!"
is this the same.
thank's to everyone.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The difference between the comparison operator (<>) and the bitwise NOT operator (!):
Comparison Operator (<>)
* Used to compare two values.
* Common examples: aa < bb, xx <> yy, zz >= 10.
* Results in a boolean value (true or false) indicating whether the comparison holds.
* Works with various numeric data types.
* GCBASIC uses <> for comparison, != is not supported.
Bitwise NOT Operator (!)
* Used to perform a bitwise inversion on a single value.
* Flips each bit (0 becomes 1, 1 becomes 0) of the binary representation of the value.
* Results in a new value with inverted bits.
* Primarily used for manipulating binary data at the bit level.
Key Differences:
Purpose: Compare vs. Invert bits. Operands: Takes two values for comparison vs. one value for bitwise inversion. Result: Boolean (true/false) vs. New value with inverted bits. Data Type: Can work with various data types vs. Primarily for binary data.
In Summary:
<> checks the relationship between two values.
! flips the bits of a single value.
They serve entirely different purposes in programming.
Last edit: Anobium 2024-03-13
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi everyone,
this is just a very simple question,
my main compiler is PBP3 Pro, and I'm use to this operator condition (<> or !=Not Equal)
but in GCStudio it's read as "=!"
is this the same.
thank's to everyone.
The difference between the comparison operator (<>) and the bitwise NOT operator (!):
Comparison Operator (<>)
* Used to compare two values.
* Common examples: aa < bb, xx <> yy, zz >= 10.
* Results in a boolean value (true or false) indicating whether the comparison holds.
* Works with various numeric data types.
* GCBASIC uses <> for comparison, != is not supported.
Bitwise NOT Operator (!)
* Used to perform a bitwise inversion on a single value.
* Flips each bit (0 becomes 1, 1 becomes 0) of the binary representation of the value.
* Results in a new value with inverted bits.
* Primarily used for manipulating binary data at the bit level.
Key Differences:
Purpose: Compare vs. Invert bits.
Operands: Takes two values for comparison vs. one value for bitwise inversion.
Result: Boolean (true/false) vs. New value with inverted bits.
Data Type: Can work with various data types vs. Primarily for binary data.
In Summary:
<> checks the relationship between two values.
! flips the bits of a single value.
They serve entirely different purposes in programming.
Last edit: Anobium 2024-03-13
Take a real example.
aa = 55 and bb = 160
aa <> bb equates to 55 <> 160 therefore true
aa =! bb equates to 55 = 95 there false
Hold on... 95... why? 160 = 0b10100000 and if you NOT this binary value you get 0b1011111... which is 95.
So, <> is a comparison and GBASIC does not support != ( as an equivalent ), and, =! is a NOT operator.
Now it's clear
Thank's Anobium