Gambas Documentation - /lang/choose

# Choose

Value = Choose ( Choice , Result1 , Result2 [ , ... ] )

This function returns the value of one of its Result #/i/ arguments, according to the value of Choice.

- If Choice is 1, then Result1 is returned.

- If Choice is 2, Result2 is returned, and so on...

- If Choice is lower or equal to zero, or if no result value is specified for the value of Choice, then NULL is returned.

### Examples

    X = 3
    PRINT Choose(X, "one", "two", "three", "four")

    three

    X = 3
    PRINT IsNull(Choose(X * 2, "one", "two", "three", "four"))

    True

### See also

- Test Control Structures & Functions