1 answer
(click or scroll down)
The three necessary parts of an if statement are:
1. Condition: It is the expression that is evaluated to determine if it is true or false. If the condition is true, the code inside the if statement is executed; otherwise, it is skipped.
2. True Block: It is the set of statements that are executed if the condition of the if statement is true. It is enclosed within curly brackets {}.
3. Optional Else Block: It is an optional part of the if statement. If the condition of the if statement is false, the code inside the else block is executed. It is also enclosed within curly brackets {}.