tags:

views:

105

answers:

1

From the Finch audio library:

- (void) play
{
    [[sounds objectAtIndex:current] play];
    current = (current + 1) % [sounds count]; // this line here...
}

I try to grok it: There is a number of sounds n, and current is increased by 1 on every iteration. As soon as current is bigger than number of sounds n, the modulo returns zero. That way, it starts from the beginning.

Is this correct?

+8  A: 

Yes, that's right.

Noah Witherspoon