In order for this site to work correctly, and for us to improve the site, we need to store a small file (called a cookie) on your computer.
By continuing to use this website, you agree to our cookies and privacy policy.
  
Home page Home page Home page Home page
Pixel
Pixel Header R1 C1 Pixel
Pixel Header R2 C1 Pixel
Pixel Header R3 C1 Pixel
Pixel

QTIPS - Testing For Boolean False

It is frequently the case that simple Boolean logic is used to detect whether a variable contains a value - e.g. IF X THEN . However this has the disadvantage that if the variable ever contains 0 and 0 is a valid response then the Boolean test would fail. This is of particular significance when processing keys, unknown data etc.

To get around this it has become traditional to test using Len() i.e. IF LEN(X) THEN .- Whilst this approach is twice as slow you are unlikely to notice the difference between 0.00005 and 0.0001 of a second unless you are processing hundreds of thousands of records. However this approach should only be used when the end result is not going to be used to extract from a dynamic array. This is because a Len() will return true for a 0 and will thus result in an ARRAY<0> being used. As an example of this, use F2 at TCL to get the TCL Popup and enter 0 - the entire TCL stack returns to the TCL window with interesting results!

(Volume 3, Issue 10, Page 4)
Pixel
Pixel Footer R1 C1 Pixel
Pixel
Pixel
Pixel