When ever you want to check if something is correct in your code, you can use the IF statement.
Basically, it is very simple:
IF(something is true) then do { the code in here }
There is another property of this statement.... it's called else, and it comes in if the code that you are verifying is not true, and you want to run some functions or some code in that case. ELSE works like this
IF(something is true) then { the code in here } else { the code in here }
So, You can verify if something is true or false and then do something on both cases.
Here is a PHP example:
//
if($words=="123")
{
$x++;
}
else
{
$i++;
}
//
In this case, if the variable $words has the value of 123 then the variable $x will have the value of $x+1; if the variable $words has the value different than 123 then the variable $i will have the value of $i+1.
Any Questions? :p
No comments:
Post a Comment