CHOOSE (Position, FirstValueParameter, OtherValueParameters...) CHOOSE (Position; FirstValueParameter; OtherValueParameters...)

Position

Number Number

The numeric position of the parameter to return.

FirstValueParameter

The first value parameter.

OtherValueParameters

Additional value parameters.

Returns

The value parameter with a numeric position matching the first parameter. If the first parameter is 2, the second value parameter (and third parameter overall) is returned. If the first parameter is 3, the third value parameter (and fourth parameter overall) is returned, etc.

Returns a parameter with the given numeric position. CHOOSE (3, 10, 20, 30, 40) CHOOSE (3; 10; 20; 30; 40) returns 30, because 30 is the third value parameter (and fourth parameter overall).

If the first parameter is 2, the second value parameter (and third parameter overall) is returned. If the first parameter is 3, the third value parameter (and fourth parameter overall) is returned, etc.

Multiple results

The first parameter is typically a number, but it can also be an array of numbers, which enables multiple results to be returned. If an array of numbers is provided, an array of results is returned.

This formula returns { 20, 40, 30 }{ 20; 40; 30 }, because the second, fourth and third value parameters are selected, in that order:

CHOOSE ({ 2, 4, 3 }, 10, 20, 30, 40)
CHOOSE ({ 2; 4; 3 }; 10; 20; 30; 40)

Examples

CHOOSE (3, 10, 20, 30, 40)
CHOOSE (3; 10; 20; 30; 40)

Returns 30, the third value parameter (and fourth parameter overall).

CHOOSE (4, 10, 20, 30, 40)
CHOOSE (4; 10; 20; 30; 40)

Returns 40, the fourth value parameter (and fifth parameter overall).

CHOOSE ({ 3, 4 }, 10, 20, 30, 40)
CHOOSE ({ 3; 4 }; 10; 20; 30; 40)

Returns { 30, 40 }{ 30; 40 }, the third and fourth value parameters (corresponding to the fourth and fifth parameters overall), in a single array.

fxEngine Shell Want this in your own terminal? A standalone version is coming. Get notified.
Loading fxEngine Shell