<< Click to Display Table of Contents >> Navigation: ThinBASIC Core Language > BuiltIn Functions > Numeric functions > Choose |
Description
Return one of several values, based upon the value of an index.
Syntax
n = Choose(index, choice1 [, choice2] ...)
Returns
Number
Parameters
Name |
Type |
Optional |
Meaning |
index |
Numeric |
No |
|
choice1 |
Numeric |
No |
An expression evaluated as number |
choice2 |
Numeric |
Yes |
... |
... |
Remarks
This function takes any number of choice arguments, and return the argument identified by index. If index evaluates to one, choice1 is returned, if two, choice2 is returned, etc. If index is less than one or greater than the number of choices provided, zero is returned accordingly.
Choose expects choices of numeric type.
Restrictions
See also
Examples