Too many 'if' statements?

前端 未结 26 1227
天涯浪人
天涯浪人 2020-11-30 16:24

The following code does work how I need it to, but it\'s ugly, excessive or a number of other things. I\'ve looked at formulas and attempted to write a few solutions, but I

26条回答
  •  孤街浪徒
    2020-11-30 16:59

    Instead do something like this

       public int fightMath(int one, int two) {
        return Calculate(one,two)
    
        }
    
    
        private int Calculate(int one,int two){
    
        if (one==0){
            if(two==0){
         //return value}
        }else if (one==1){
       // return value as per condtiion
        }
    
        }
    

提交回复
热议问题