ListValid
Synopsis
ListValid(exp)
Parameters
exp | Any valid expression. A valid list must be created using ListBuild or ListFromString, or extracted from another list using List. The null string ("") is also treated as a valid list. |
Description
ListValid determines whether exp is a list, and returns a Boolean value: If exp is a list, ListValid returns 1; if exp is not a list, ListValid returns 0.
A list can be created using ListBuild or ListFromString, or extracted from another list using List. A list containing the empty string ("") as its sole element is a valid list. The empty string ("") by itself is also considered a valid list.
Examples
The following examples all return 1, indicating a valid list:
w = ListBuild("Red","Blue","Green") x = ListBuild("Red") y = ListBuild(365) z = ListBuild("") Println ListValid(w) Println ListValid(x) Println ListValid(y) Println ListValid(z)
The following examples all return 0. Numbers and strings (with the exception of the null string) are not valid lists:
x = "Red" y = 44 Println ListValid(x) Println ListValid(y)
The following examples all return 1. Concatenated, nested, and omitted value lists are all valid lists:
w = ListBuild("Apple","Pear") x = ListBuild("Walnut","Pecan") y = ListBuild("Apple","Pear",ListBuild("Walnut","Pecan")) z = ListBuild("Apple","Pear",,"Pecan") Println ListValid(w & x) ' concatenated Println ListValid(y) ' nested Println ListValid(z) ' omitted element
The following examples all return 1. ListValid considers all of the following “empty” lists as valid lists:
Println ListValid("") Println ListValid(ListBuild()) Println ListValid(ListBuild(NULL)) Println ListValid(ListBuild("")) Println ListValid(ListBuild(Chr(0))) Println ListValid(ListBuild(,))
See Also
List function
ListBuild function
ListExists function
ListFind function
ListFromString function
ListGet function
ListLength function
ListNext function
ListSame function
ListToString function