Error getting tags :
error 404Error getting tags :
error 404 is a | revDocs | RunRev
Welcome Guest (Log in)
Product Edition
Version
is a
Basics
Expander triangle
Type
Operator
Syntax

value is a[n] {array | boolean | color | date | integer | number | point | rect }

Introduced
1.0
Changed
2.9
Environment
Desktop, Web and Server
Platform Support
MacOS,Mac OS X,Windows,Linux
Security
None required
Summary
Evaluates to true if a value is of the specified type, false otherwise.
Examples

"1/16/98" is a date -- evaluates to true
1 is a boolean -- evaluates to false
45.4 is an integer -- evaluates to false
"red" is a color -- evaluates to true
rraylocal tArray
put "test" into tArray[1]
put tArray is an array -- evaluates to true

Additional Comments
Expander triangle

Use the is a operator to validate data to make sure it's the right type.

Parameters:

The value is any source of value.

Comments:

This operator is useful for checking whether the user has entered data correctly, and for checking parameters before sending them to a handler to avoid a script error caused by feeding data of one type to an operator or function that requires a different type.

A value is a(n):

* array if it's keys function is not empty.

* boolean or logical if it is one of the two constants true or false

* color if it is a valid color reference

* date if it is in one of the formats produced by the date or time functions

* integer if it consists of digits (with an optional leading minus sign)

* number if it consists of digits, optional leading minus sign, optional decimal point, and optional "E" or "e" (scientific notation)

* point if it consists of two numbers separated by a comma

* rect if it consists of four numbers separated by commas

All the types other than boolean can also include leading or trailing white space characters.

Note: To ensure compatibility with SuperCard stacks, the is a color operator returns true for any integer, although integers are not valid colors in Revolution. If you need to strictly verify a color then you can write a wrapper function to do so that checks that the color is not an integer.

Note: The range of dates that Revolution can handle is limited by the operating system's date routines. In particular, Windows systems are limited to dates after 1/1/1970. This means that the is a date operator will return false for dates before 1/1/1970 on Windows.

The is a operator is the logical inverse of the is not a operator. When one is true, the other is false.

Changes to Revolution:

The is an array form was added in version 2.9

User Comments
Expander triangle