Replacing nested if statements

前端 未结 11 1956
春和景丽
春和景丽 2020-12-23 20:44

This is related to a chapter from beautiful code. And in that chapter I read about the nested ifs.

The author was talking about deeply nested if

11条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-23 21:40

    Another example some languages allow is this

               switch true{
                case i==0
                  //action
                break
    
                case j==2
                 //action
                break
    
                case i>j
                 //action
                break
               }
    

提交回复
热议问题