Operators
Description:
What are operators in a programming language and what are they
The following are symbols you can use in comparisons and their explanations. Some have been used in examples already.
Operator | Meaning | Usage |
---|---|---|
== | Left is equal to Right | if (Left == Right) |
!= | Left is not equal to Right | if (Left != Right) |
> | Left is greater than Right | if (Left > Right) |
>= | Left is greater than or equal to Right | if (Left >= Right) |
< | Left is less than Right | if (Left < Right) |
<= | Left is less than or equal to Right | if (Left <= Right) |
&& | and | if (Left && Right) |
|| | or | if (Left || Right) |
! | not | if (!Variable) |
nor | if (!(Left || Right)) | |
nand | if (!(Left && Right)) | |
exclusive or (xor, eor) - only one or the other is true, not both | if (!(Left && Right) && (Left || Right)) | |
not exclusive or (nxor, neor) - both or neither are true | if ((Left && Right) || !(Left || Right) |