假设你有一个像这样的for循环
for(n in 1:5) {
#if(n=3) # skip 3rd iteration and go to next iteration
cat(n)
}
Run Code Online (Sandbox Code Playgroud)
如果满足某个条件,如何跳到下一次迭代?
Ale*_*tov 136
for(n in 1:5) {
if(n==3) next # skip 3rd iteration and go to next iteration
cat(n)
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
92123 次 |
| 最近记录: |