如果你想根据两个或多个条件执行某些代码,这是格式化if语句的最佳方法?
第一个例子: -
if(ConditionOne && ConditionTwo && ConditionThree)
{
   Code to execute
}
第二个例子: -
if(ConditionOne)
{
   if(ConditionTwo )
   {
     if(ConditionThree)
     {
       Code to execute
     }
   }
}
这是最容易理解和阅读的,记住每个条件可能是一个长函数名称或其他东西.