Decision Making in Groovy
In groovy, decision-making is used to check the condition and execute the statements. if the condition is true then the true block statement is executed and if the condition is false then the false block is executed.
In groovy, if statement is used when we have only one condition. In if statement there is only true block. If the condition is true then the true block is executed. There is no false or else block in this statement.
If else statement
In groovy, if else statement is used when only one condition. In if else statement we have a true as well as false or we can say else block. If the condition is true then the true block is executed otherwise else block is executed.
Nested If Statement
In groovy, Nested if statement is used when we have more than one condition.
In groovy, a switch is a multiway branch statement. It provides an easy way to execute different parts of the code which are based on the value of the expression.