A condition is checked and execute statement/block of statements if the condition is true.
| C++ | Python | ||
|---|---|---|---|
| Syntax if (condition) { statement1; statement2; ... } |
Syntax if condition: statement1; statement2; ... |
||
Example int a = 10; int b = 15; if (a<b) { cout<<"a < b."; } | Example a,b = 10, 15; if a<b: print("a < b") |
No comments:
Post a Comment