In an implementation of a CGRect, I attempt this:
BOOL didStartPressing = NO;
if ( didStartPressing) {int nmax=5;}
else{int nmax=500;}
for (int n=1; n<nmax; n=n+1){ *... working code that draws some circles ....* }
This gives yellow warnings about “unused variable nmax” in the first part above
and red warnings about “use of undeclared variable nmax.” for the for loop.
If however I simply replace the first three lines above with
int nmax=500;
I get a lovely picture that I drew in CGRect.
Greatest of thanks for help, as I’m complete noob up against the hard wall of learning curve.
You’ve limited the scope of
nmaxto the braces after theifand theelse. So you have two variables with that name, neither of which is visible to theforloop. To solve, move the declaration to the outer scope and simply assign to the variable in theif/elsescopes: