每次数达到10(10,20,30,40)时重复动作

Dra*_*c3_ 2 java

我是一个新手程序员,所以如果这是一个愚蠢的问题,抱歉,但如果你不问你不知道.

我想要的代码是当你达到10分,20分,30分,40分......它会发出与常规ping噪声不同的声音.那是我目前的代码,有什么方法可以做我说的话?

if (score == 10) {
    Sound.soundScore1();
}
Run Code Online (Sandbox Code Playgroud)

Arn*_*lca 6

if (score % 10 == 0) {
    Sound.soundScore1();
}
Run Code Online (Sandbox Code Playgroud)

意思是,如果除以10(也就是模数运算符%)的余数为0.