In this lesson we'll be exploring conditional statements when writing code.
We often want an action to occur based on an event where condition in BHP.
We have different types of conditional statements including if statements.
If else statements if else and else if statements and switch statements will start with an example of
a basic if statement here we have a variable X set the value of forty nine we've created an if statement
with one condition.
If the value of x is less than 50 we want to output the words condition met
since forty nine is less than 50.
We can see in our web browser that the words were output at condition met.
Now what would happen if the condition was not met.
Let's say we said X to fifty one
in this case fifty one is not less than 50
so there is no output in our web browser there is no output because we have not instructed our script
on how to handle this situation to do so we can add an else statement.
Let's create an L statement that outputs the words condition not met.
If X is not less than 50
so let's recap what we've done here.
If if x is less than 50 output condition met if X is anything else and there can only be one other thing
that x is greater than 50 output condition not met
so we can see in our web browser that it now outputs condition not met because X is not less than 50.
You can change the value of x to test different results.