UpBound

concerns

The UpBound function  returns the greatest index occupied in the specified list. If the list does not contain any values, UpBound returns -1.

 

Syntax

UpBound(Var)

Return value

Type

Description

Long

The greatest index.

Parameter

Use

Name

Type

Passing

Description

Required

Var

List variable of any type

ByRef

Must be a list

 

Note

The smallest possible list index of lists in TCE is zero. Lists do not need to be dimensioned. For example, if you assign a value to an empty list, such as list index 3 and list index 5, the list has a low bound value of 3 and an upbound value of 5.

 

Example

Dim Names() As String

Dim MaxIndex As Long

Names(1) := "Muller"          # Index 0 wird nicht belegt

Names(3) := "Maier"

Names(7) := "Schmitt"

MaxIndex := UpBound(Names)

 

Result: MaxIndex = 7

 

See also LowBound