이경수 선생님의 수학실험실

Control Structures_Next 본문

R

Control Structures_Next

(이경수) 2021. 4. 15. 15:28
> for(i in 1:20){
+     if(i<10){
+         next
+     } else {
+         print(i)
+     }
+ }
[1] 10
[1] 11
[1] 12
[1] 13
[1] 14
[1] 15
[1] 16
[1] 17
[1] 18
[1] 19
[1] 20

next는 루프를 벗어날 때 사용한다.

 

'R' 카테고리의 다른 글

Loop Functions - lapply  (0) 2021.04.15
Function  (0) 2021.04.15
Control Structure_if else & for loops  (0) 2021.04.15
Control Structures_While loops  (0) 2021.04.15
Subsetting_Removing Missing Values  (0) 2021.04.15
Comments