if statment

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • miss time
    New Member
    • Jun 2007
    • 16

    #1

    if statment

    hi
    can any one help me pleaseto understand about if statment because Idid not really understood this topic from teacher and i will have final exam after few day

    thank you
  • dmjpro
    Top Contributor
    • Jan 2007
    • 2476

    #2
    Originally posted by miss time
    hi
    can any one help me pleaseto understand about if statment because Idid not really understood this topic from teacher and i will have final exam after few day

    thank you
    It is a conditional statement in programming paradigm.
    And it's syntax in JS is like ....


    [code=text]
    if(condition) //some statement.
    else // do something else.
    if the condition is true then first statement executed otherwise else part ll be executed.
    take another example.
    if(condition1) //statement1
    else if(condition2) //statement2
    .
    .
    .
    else statement_n
    here it is if-else ladder.
    now else can not exist without if.
    as for example ....
    else //statement ... it is an error because else does not exist without if.
    [/code]

    I think u got my point.
    Have a good day.

    Kind regards,
    dmjpro.

    Comment

    • r035198x
      MVP
      • Sep 2006
      • 13225

      #3
      Originally posted by miss time
      hi
      can any one help me pleaseto understand about if statment because Idid not really understood this topic from teacher and i will have final exam after few day

      thank you
      Now write some code that uses the if statement and post if you get errors.

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Originally posted by miss time
        hi
        can any one help me pleaseto understand about if statment because Idid not really understood this topic from teacher and i will have final exam after few day

        thank you
        See this link .

        Comment

        Working...