It is used to shift the program control out of the scope if there is scope when one or more condition is not met. It is also called as early exit and similar to the ‘if statement’. By using the Guard statement, we can avoid the pyramid of doom.
Example :
guard expression else {
//statements
//must contain a control statement:return, break, continue or throw.
}