• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

if statement woes

Brian Berry

Well-Known Member
I can't wrap my head around how to write the following if statement. Some help would be greatly appriciated


"if a counter variable has decremented by one then allow"

i
Code:
cou0--
if(cou0 ???){
  //cou0 has changed
}
 
How does cou0 get decremented? It seems to me you either need another variable to contain the old value of cou0, or a flag that is set whenever cou0 is decremented by 1 (but it would need to be reset when it's not decremented, which might be difficult to define).
 
Nullifichations dont seem to work on the numb er part of mc9s ai employs or deploys. Both Na ILs dueso work as imPITes/runiA mitSirefermikula
 
I can't wrap my head around how to write the following if statement. Some help would be greatly appriciated

"if a counter variable has decremented by one then allow"

Code:
cou0--
if(cou0 ???){
  //cou0 has changed
}

Seems to me that the only really reasonable way to do that would be to set a temp var before whatever code decrements it:
Code:
ctemp = cou0
// whatever code determines the decrement
cou0--
if (cou0 == ctemp-1) {
  // cou0 has changed
}

I don't see any other approach that would be viable.
 
Back
Top Bottom