List.elements Method

Specifies the number of elements in a list.

Syntax

public int elements()

Run On

Called

Return Value

Type: int
The number of elements in the list.

Examples

The following example creates a list of integers and adds some elements to it. The elements method is used to test whether there are three elements in the list.

{ 
    List il = new List(Types::Integer); 
 
    il.addStart(1); 
    il.addStart(2); 
    il.addStart(3); 
    if (il.elements() != 3) 
    { 
        print "Something is wrong..."; 
    } 
}

See Also

List Class

List.empty Method