do {…} while(false)

前端 未结 25 2462
小鲜肉
小鲜肉 2020-11-28 03:29

I was looking at some code by an individual and noticed he seems to have a pattern in his functions:

 function()
{
 

        
25条回答
  •  执念已碎
    2020-11-28 04:07

    In such cases I use

    switch(true) {
       case condution1:
          ...
          break;
       case condution2:
          ...
          break;
    }
    

提交回复
热议问题