If Statement (Conditional Statement)
Use an if statement to change the output conditions based on changing
the input conditions.
The if() statement is the most basic of all programming control structures. It allows
you to make something happen or not, depending on whether a given condition is
true or not. It looks like this:
if (someCondition) {
// do stuff if the condition is true
} else {
// do stuff if the condition is false
}
It’s your turn!
Try now to write the code for our “Function do_calc” : if nbre1 is less or equal to
nbre2 then display the result of their sum a+b if not display the result of the following
operation: a-b :
CLUB ROBOTIQUE
Kairouan Centre-Ville ( Gargabiya)
Hamza Belgarouia
54405750