Continues if statement

mentioned call function is working fine as my expected but question is that using simple if statement continues is correct or i need change.

void numberdown(void){
  
  if(a>1){a--;}
  if(b>2){b--;}if(c>3){c--;}if(d>4){d--;}if(e>5){e--;}if(f>6){f--;}  }

A bit more information please.

The way you’ve formatted it, it’s very hard to read…

Drop them onto their own lines, and complete the conditional block, then we’ll have some idea of what you’re trying to achieve

The curly braces you’ve used are irrelevant the way you’ve used them..!

Your code is legit assuming the variables exist and are within scope

void numberdown() {
  if (a > 1) a--;
  if (b > 2) b--;
  if (c > 3) c--;
  if (d > 4) d--;
  if (e > 5) e--;
  if (f > 6) f--;
}

As mentioned above try to indent correctly, use the space bar of your keyboard and when an if clause is a single statement you don’t need the curly brackets so it makes reading lighter.

thanks... my exact question multiple if statement is correct or if, elseif... else has to be followed.

because i am using numberdown() to only the decrement values inside a to f variables with minimum numbers condition . my doubt is multiple simple if statement is efficient or nested if is efficient .

It depends what you want to do
If you use an else you get one or the other. If you don’t - like above - all the variables get a chance to be decreased.

If your if are needed, then they are needed. Don’t second think this