if statement is used to specify a block of code to be executed if the condition is true.
Syntax –
if(condition){
statement;
}
Note – if is in lowercase letter. If you use the uppercase letter (If/IF) it will generate an error.
Flowchart –
So let’s understand with an example. In the below example we check the condition 20 is greater than 10.
Example –
Output –
Example explained – So in the above example we know the 20 is greater than 10. So, the condition is true, and we print the screen “20 is greater than 10.”
So if you want to learn more about then join our course.