Wednesday, July 23, 2014

If statements

  • If statements is very important in our job how? you can use this when we want to make a speical action to happen only when our condition of that thing happen for example you want to delete what in  the text box only when its empty for this we use if(statements){............} 
  • you should know that everything you write our of these braces of the if condition it'll happen no matter if the condition occurred or not 
  • lets see a few example and show the output of it:


the alert wont happen unless the value of x is zero 
  • what if we wont do to an action if our condition didnt valid i mean if x wasn't zero we
     should show something we can easly write:

         but this alert(1); will happen even if the condition happened or not so how to stop this from happening           unless if the condition didnt happen this can happen if we use else statements this will happen only and           only if the first if didnt happen and we cant use it without previous if lets see this
 

alert(1) wont happen unless x is not 0








No comments:

Post a Comment