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

If

Conditional expression using if can be used. The section which represents condition is placed after if keyword, and () is not required surrounding it. An expression at true condition is placed after ?, and an expression at false condition is placed after :.

module ModuleA {
    let a: logic<10> = 1;
    var b: logic<10>;

    assign b = if a == 0 ? 1 : if a >: 1 ? 2 : 3;
}