How to skip “0” from a for() statement [closed]

The ‘continue’ keyword would accomplish what you’re asking given the right logical condition. The example code you gave doesn’t say what mix_values or max_values is.

for(int x = mix_values; x <= max_values; x++ ) {
     if( x == 0 ) { continue; }
     // ...the rest of your loop body logic goes here...
}

I’m assuming 0 would always come after -1 (if min_values < -1) given x++.

Leave a Comment