Multiple if loops or a single if with AND condition

Posted by Ram on Stack Overflow See other posts from Stack Overflow or by Ram
Published on 2010-04-22T09:29:22Z Indexed on 2010/04/22 9:33 UTC
Read the original article Hit count: 199

Filed under:

If I need to check multiple conditions, which is the preferred way with respect to performance

if( CND1 && CND2 && CND3 && CND4)
{
}
else
{
}

or

if(CND1)
{
 if(CND2)
    {
       if(CND3)
       {
          if(CND4)
          {
          }
    }
 }
}

© Stack Overflow or respective owner

Related posts about coding-style