Note: information on this page refers to Ceylon 1.1, not to the current release.

is operator

The non-associating, binary infix is operator is used to test the type of an expression.


void m(Object? obj) {
    Boolean isNumber = obj is Number;
    Boolean isNull = obj is Null;



The is operator is primitive.

Note that because Ceylon supports reified generics you may use is with a parameterized type, for example you can write

Boolean intList = obj is List<Integer>;


The is operator is not polymorphic.


The result type of the is operator is Boolean.


Do not to confuse the is operator described here and which takes the infix form attribute is Type with the is condition used in if, assert and while statements and which takes the prefix form is Type attribute.

See also