Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Type matching

“is” operator

v is T

“switch type” statement

switch type (v) {
    case (d : Date) {
    }
    default {
    }
}

switch type also works on algebraic data types:

switch type (exp) {
    case (Plus(10, right)) {
    }
}

“if let” statement

if (let Plus(10, right) = exp) {
}