Pgroramming Fundamentals

How and why building with the if Statment??

Could you please explain more? I am not sure what you are asking about the if statement.

1 Like

if statement provides you to test value of certain variable and do different actions depending if condition is met or not (true or false).
It is most basic technique that provides you program to behave differently under certain conditions. If the were no such statement program will be simple set of commands that executes in the same way every time and provides always same result, and programming would be extremely limited.

Example :slight_smile:

var a = 5;

if(a > 10){
// do something
} else {
// do something else
}