repeat循环=while(true)循环
i = 0
repeat {
i <- i+1
if(i==4) {
next;
}
print(1:i);
if(i==10) {
break;
}
}
输出结果:
[1] 1
[1] 1 2
[1] 1 2 3
[1] 1 2 3 4 5
[1] 1 2 3 4 5 6
[1] 1 2 3 4 5 6 7
[1] 1 2 3 4 5 6 7 8
[1] 1 2 3 4 5 6 7 8 9
[1] 1 2 3 4 5 6 7 8 9 10
时间: 2025-01-11 11:31:36