Home:ALL Converter>Why it can get in the For loop?

Why it can get in the For loop?

Ask Time:2016-04-14T10:38:09         Author:D.Wade

Json Formatter

array has 0 objects, so array.count is 0, and then (array.count - 1) is -1, i < -1 is -1, why it can get in this for loop?

for (int i=0; i<array.count-1; i++) {
    NSLog(@"why it can get in this for loop?");

    for (int j=0; j<array.count-i-1; j++) {          
        NSLog(@"why it can get in this for loop?");     
    }
}

Author:D.Wade,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/36612905/why-it-can-get-in-the-for-loop
yy