This documentation was styled with a demo skin from the Premium Pack 4 add-on for Help & Manual. The contents of the skin are encrypted and not configurable. You can only publish HM projects with this skin. You cannot edit it or change it.
This version is copyright and may only be used for local testing purposes. It may not be distributed.
Please purchase the full version of the Premium Pack to get the configurable skins and remove this notice. The package will also include the Toolbox configuration utility for Premium Pack skins.
Description
Return one of several values, based upon the value of an index.
Syntax
s = Choose$(index, choice1 [, choice2] ...)
Returns
String
Parameters
Name |
Type |
Optional |
Meaning |
index |
Numeric |
No |
Numeric expression whose value will be used as index for choosing string expression |
choice1 |
String |
No |
An expression evaluated as string |
choice2 |
String |
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, an empty string is returned accordingly.
Choose$ expects choices of string type.
Restrictions
See also
String Handling, SELECT, Choose
Examples
Thanks to Abraxas for the following script example
' Usage of the Choose$ Instruction example
' Returns the indexed String
Dim Mychoice As DWORD VALUE 3
Dim Mystring As String VALUE "Option 3"
Dim RetString As String
RetString = CHOOSE$ (Mychoice, "Option 1", "Option 2", MyString)
MSGBOX 0, RetString