views:

117

answers:

4

I found it not correct to do this in Objective C. So anything wrong here?

for (int i=10; i<=0; i--)
+10  A: 

The condition you've specified is wrong, following is the correct one.

for (int i=10; i>=0; i--)
Bragboy
lol, thanks man
shawhu
+1  A: 

I think you want

for (int i=10; i>=0; i--)
mdresser
right, i thought it could be objc's problem, i always blame others, never thought that it's probably my own mistake
shawhu
+3  A: 
for (int i=10; i>=0; i--)

You had it as less than or equal to zero, not greater than or equal to zero

Cez
Hmm.. slightly late, but no "other post" alert.. oh well
Cez
thanks for your help
shawhu
+3  A: 

As others have noted, you want i >= 0. Also note that if you're iterating through 10 items, i should start at 9, not 10.

michael
of course you are right
shawhu