This statement is simply used to tell the computer 'What to do in case of a certain situation". If a certain condition is true, execute a block of code. By 'condition being TRUE' it is meant that the mentioned condition is being met.
if statement SYNTAX
if (Condition)
{
Block of code to be executed, if condition is True
}
LOWER CASE???
If the condition however is TRUE the code is executed and the browser moves to the next line in the HTML document.
If the condition is FALSE, then it simply moves to the next lines
Example
We looked at a simple example in the previous lesson. we will now write that example in JavaScript code.
If (gender = male)
if statement SYNTAX
if (Condition)
{
Block of code to be executed, if condition is True
}
LOWER CASE???
If the condition however is TRUE the code is executed and the browser moves to the next line in the HTML document.
If the condition is FALSE, then it simply moves to the next lines
Example
We looked at a simple example in the previous lesson. we will now write that example in JavaScript code.
If (gender = male)
Aucun commentaire:
Enregistrer un commentaire