If
Conditional expression using if
can be used.
The section which represents condition is placed after if
keyword,
and ()
is not required surrounding it.
else
is mandatory because if expression always have to be evaluated to value.
module ModuleA {
let a: logic<10> = 1;
var b: logic<10>;
assign b = if a == 0 {
1
} else if a >: 1 {
2
} else {
3
};
}