mercredi 17 juillet 2019

If an "if" statement has multiple conditions where one evaluates to false, does it check the remaining conditions before exiting? [duplicate]

This question already has an answer here:

Inside an "if" statement, if multiple conditions are being evaluated and one of them evaluates to false, will the "if" statement immediately exit/terminate or will it evaluate the remaining conditions and then make the decision to exit?

For

if ((true) && (false) && (true) && (true) && (true))

Will the if statement immediately stop when it encounters that the second condition is false. Or will it evaluate the remaining conditions and then make the decision to stop.

To put this in other words:

//a

if(true)
  {
   if(false)
    {
      if(true)
       {
        if(true)
         {
           if(true)
            {
            }
         }
       }
    }
  }

//b

if ((true) && (false) && (true) && (true) && (true))

// is a = b ?

Aucun commentaire:

Enregistrer un commentaire