2010-05-03 68 views
1

从芬奇音频库:“foo =(foo + 1)%bar”究竟干什么?

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

我试图神交它:有一些声音ñ,并current是在每次迭代增加1。只要current大于声音的数量n,模数返回零。这样,它从一开始就开始。

这是正确的吗?

回答

8

是的,没错。

相关问题