#29067 - 2002-09-15 03:37 PM
NOT vs Greater-Than/Less-Than
|
mjoni
Fresh Scripter
Registered: 2002-05-11
Posts: 13
|
What is the difference between "NOT" and "<>" are they basically the same thing? I don't understand when it would be appropriate to use one over the other...
If @ERROR <> 0...
If @ERROR NOT 0...
Any thoughts?
|
|
Top
|
|
|
|
#29070 - 2002-09-15 04:07 PM
Re: NOT vs Greater-Than/Less-Than
|
mjoni
Fresh Scripter
Registered: 2002-05-11
Posts: 13
|
I kind of get it- but I don't understand how you would use NOT.
If NOT 5
is the correct syntax, but if What is not 5? By itself it doesn't seem to be of any use.
If $X NOT 5
seems logically correct, but like you say is bad syntax. I cannot find any script examples that use NOT. Have you ever used it in a real script?
|
|
Top
|
|
|
|
#29073 - 2002-09-15 04:38 PM
Re: NOT vs Greater-Than/Less-Than
|
mjoni
Fresh Scripter
Registered: 2002-05-11
Posts: 13
|
So if $X has any value then
NOT $X = 0
If $X is not null (has any value at all)
NOT $X = 1
I've got it!?!
|
|
Top
|
|
|
|
#29075 - 2002-09-15 05:02 PM
Re: NOT vs Greater-Than/Less-Than
|
Lonkero
KiX Master Guru
   
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
might even say, bitwise. if you ever play with boolean values, you will see operands like: not, and, or [xor, xnor, nand]
anyway, if you don't see where you would use that, do you need it then?
what comes to the resulting value, having anything in the var, results with not nothing. if the value in the var is 0, output is true (1)
it's easier to demonstrate, so try this:
code:
$x=5 ? not $x $x="a" ? not $x
$x=0 ? not $x $x="" ? not $x
you will see, first 2 have zero (false) value output and last ones come with 1 (true) output.
_________________________
!download KiXnet
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 857 anonymous users online.
|
|
|