if statement
Syntax
IfStatement :
ifExpression{(Statement | Expression)+
}
(else{
(Statement | Expression)+
})?
Example:
contract Foo {
    pub fn bar(val: u256) -> u256 {
        if val > 5 {
            return 1
        } else {
            return 2
        }
    }
}
The if statement is used for conditional execution.