Skip to main content

$isvector (ObjectScript)

Validates a vector value and returns a boolean.

Synopsis

$isvector(expr) 

Description

The $isvector function determines if the input argument is a vector. If the input argument is a vector, the function returns 1 (true). The vector can be of any valid vector type, any length, and elements need not be contiguous. Valid vector types are decimal, double, integer, string, and timestamp.

If the input argument is not a vector, the function returns 0 (false). The function also returns false if the input expression is undefined or evaluates to the empty string.

Arguments

expr

Any ObjectScript expression.

Examples

The following example defines a length-10 vector of random integers between 1 and 100, defining every other element, checks if the defined vector is a vector, and writes the result. It also checks if a string is a vector and writes that result.

for i=2:2:10 set $vector(vector,i,"integer") = $random(100)+1
set isvec = $isvector(vector)
write isvec  // writes 1

set notvec = "This is not a vector."
set notvec = $isvector(notvec)
write notvec  // writes 0

See Also

FeedbackOpens in a new tab