Ad
  • Custom User Avatar

    @Johan it will not generate a syntax error unless there's an else after it...
    else it will do weird stuff, and definitely not what you want...

  • Custom User Avatar

    They're only necessary if there's more than one statement.

    Of course, if you don't have them and add another statement to do more cool stuff, you should not forget to enclose them with curly brackets. Or interestingness happens ( it may not even generate a syntax error ).

  • Default User Avatar

    Hey, I can't understand why you people use
    if(condition)
    do cool stuff;
    else if(condition)

    instead of
    if(condition){
    do cool stuff
    }else if(condition){
    do cool stuf
    }

    I had to unlock the answer, but I can't seem to find anything that explains this. Why don't you use curly brackets {}?