Operators keyword

is

Type test — equivalent to Java instanceof.

expr is Type checks whether a reference is an instance of the given type. Often paired with guard for early exits or with if for branching.

Affogato

example.aff
func check(obj: Object) {
    if obj is String {
        println(obj as String)
    }
}

Generated Java

Example.java
public void check(Object obj) {
    if (obj instanceof String) {
        System.out.println(((String) obj));
    }
}

Related

See also

← All keywords