Click or drag to resize

InList Function

X#
Indicate whether the first expression in a series is repeated later in the series.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax
 FUNCTION InList(
	uValue AS USUAL,
	uValueList PARAMS USUAL[]
) AS LOGIC
Request Example View Source

Parameters

uValue
Type: Usual
The value that is looked up in the list. This can be any data type.
uValueList
Type: Usual
A list of expressions separated by commas.
These expressions should be the same data type as the expression in uValue
If one or more of these expressions are not the same type as the first expression, a runtime error may happening indicating a data type mismatch.

Return Value

Type: Logic
TRUE if the first expression matches any of the other listed expressions; otherwise, FALSE.
Remarks
InList() determines whether an expression is found in a series of expressions. The first expression is compared to each of the other expressions until either a match is found or the entire list has been traversed. For exact matching, use InListExact().
Examples
This examples use InList() to indicate whether the first expression in each series is repeated later in the series:
X#
1? InList("b", "a", "b", "c")        // TRUE
2? InList("d", "a", "b", "c")        // FALSE
3nJack  := 11
4nQueen := 12
5nKing  := 13
6nAce   := 14
7? InList(nJack, nQueen, nKing, nAce)     // FALSE
8? InList(nJack, nAce, nJack, nQueen, nKing)     // TRUE
See Also