|
|||||||
QTIPS - Testing For Boolean FalseIt 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) |
|||||||
| |||||||