&& operator is not working on range based loops



  • Hi
    && operator is not working on range based loops. For example, if we have 3 statements with 3 ranges inside the different 2 if statement:

    range 1: 0 to 2;
    range 2: 2 to 5;
    range 3: 5 to 10;
    .....

    this one doesn't work;

    NOTE: knob values are decimal numbers, not whole numbers.

    if (x1 == 0)
           {
    
                  if (knob <= 2)
                    {
                        
    	 
                    }
    
                   if (knob <= 5 && knob> 2)
                    {
                        
    	 
                    }
    
                  if (knob <= 10 && knob> 5)
                    {
                        
    	 
                    }
         }
    
    
    if (x1 == 1)
           {
    
                  if (knob <= 3)
                    {
                        
    	 
                    }
    
                   if (knob <= 6 && knob> 3)
                    {
                        
    	 
                    }
    
                  if (knob <= 11 && knob> 6)
                    {
                        
    	 
                    }
         }
    
    
    
    


  • @orange Ok, I've solved it. It works like a charm 🙂


Log in to reply
 

1
Online

470
Users

1.6k
Topics

11.8k
Posts