mercredi 1 juin 2016

if condition best practice

I have the following:

if(A==B)
{
  //do stuff
}

if(C==B)
{
  //do stuff
}


  if(A==B)
    {
      //do stuff
    }
    else if(C==B)
    {
      //do stuff
    }

What is the difference between the two? I get the meaning of it but. I have seen programmers prefer the first one instead of the 2nd one? why?

I personally prefer the 2nd one.

Aucun commentaire:

Enregistrer un commentaire