Choose Function

Devolve o valor seleccionado dunha lista de argumentos.

Sintaxe:

Choose (Índice, Selección1[, Selección2, ... [,Selección_n]])

Parámetros:

Index: A numeric expression that specifies the value to return.

Selection1: Any expression that contains one of the possible choices.

The Choose function returns a value from the list of expressions based on the index value. If Index = 1, the function returns the first expression in the list, if index i= 2, it returns the second expression, and so on.

Se o valor do índice é menor que 1 ou maior que o número de expresións listadas, a función devolve un valor nulo (Null).

The following example uses the Choose function to select a string from several strings that form a menu:

Códigos de erro

5 Chamada de procedemento incorrecta

Exemplo:

Sub ExampleChoose

Dim sReturn As String

    sReturn = ChooseMenu(2)

    Print sReturn

End Sub

 

Function ChooseMenu(Index As Integer)

    ChooseMenu = Choose(Índice, "Formato rápido", "Gardar formato", "Formato do sistema")

End Function