What is this line doing exactly?
Posted
by mystify
on Stack Overflow
See other posts from Stack Overflow
or by mystify
Published on 2010-05-03T19:14:04Z
Indexed on
2010/05/03
19:18 UTC
Read the original article
Hit count: 241
objective-c
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?
© Stack Overflow or respective owner