Quote:

I prefer NOT to <> as it's clearer for non-programmers (or non-scripters) to understand what it's doing...




Careful, "NOT" and "<>" do completely different things. Don't fall into the trap of thinking that they are interchangeable. You can often use them to get the same result, much as you can use a hammer to drive a screw.

Be very careful when using things like NOT, also when using the item value for boolean truths. All variables in KiXtart are variants, and KiXtart will convert between sub-types silently when it has to.

This can mean that your numeric values can be easily cast to string variants. This catches people out because a string with a value of "0" is actually TRUE, whereas a number with a value of 0 is FALSE. However a zero length string is FALSE.

The most common example of confusion is when reading registry values, which are always returned as strings regardless of registry type.

For example:
Code:
"0 is " IIf(0,"TRUE","FALSE") ?
"1 is " IIf(1,"TRUE","FALSE") ?
"'0' is " IIf('0',"TRUE","FALSE") ?
"'1' is " IIf('1',"TRUE","FALSE") ?
"'' is " IIf('',"TRUE","FALSE") ?



Gives:
Quote:

0 is FALSE
1 is TRUE
'0' is TRUE
'1' is TRUE
'' is FALSE