如果条件如下,我必须写重复的其他内容:
if (d_hand[1]==1){
state=score(p_hand)-1
} else if (d_hand[1]==2){
state=19+score(p_hand)
} else if (d_hand[1]==3){
state=39+score(p_hand)
} else if (d_hand[1]==4){
state=59+score(p_hand)
} else if (d_hand[1]==5){
state=79+score(p_hand)
} else if (d_hand[1]==6){
state=99+score(p_hand)
}
Run Code Online (Sandbox Code Playgroud)
你知道它是否可以更快/更快地写出来吗?我想过做一个if循环,但效率会降低,因为必须检查每个语句.
| 归档时间: |
|
| 查看次数: |
86 次 |
| 最近记录: |