Navigation:  thinBasic Modules > Core > Numeric handling >

CHOOSE

Previous pageReturn to chapter overviewNext page

 

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

String

No

An expression evaluated as number

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, zero is returned accordingly.

 

CHOOSE expects choices of numeric type.

 

Restrictions

 

See also

 

Examples

 

 

 

 

 

© 2004-2008 thinBasic. All rights reserved. Version 1.7.0.0 Web Site: http://www.thinbasic.com