1
从芬奇音频库:“foo =(foo + 1)%bar”究竟干什么?
- (void) play
{
[[sounds objectAtIndex:current] play];
current = (current + 1) % [sounds count]; // this line here...
}
我试图神交它:有一些声音ñ,并current
是在每次迭代增加1。只要current
大于声音的数量n,模数返回零。这样,它从一开始就开始。
这是正确的吗?