Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
None
-
None
Description
For the following code...
toText(UNSIGNED1 i) := CHOOSE(i,'one','two','elsevalue');
OUTPUT(toText(0));
OUTPUT(toText(1));
OUTPUT(toText(2));
OUTPUT(toText(3));
OUTPUT(toText(4));
The values 1 and 2 yield their counterparts, and the values 3 and 4 yield 'elsevalue' as expected. However, passing 0 yields 0.
Shouldn't passing 0 yield 'elsevalue'?
I do see I'm violating the expected type of input, as the first parameter is described in the user's guide as "An arithmetic expression that results in a positive integer and determines which value parameter to return". However, given the elsevalue is broadly described as "The value to return when the expression returns an out-of-range value", it seems more logical to return it rather than lapse into undefined behavior.
Attachments
Issue Links
- is duplicated by
-
HPCC-14556 CHOOSE problem
-
- Resolved
-