> ctr <- 1 > while(ctr <= 5){ + print(paste("ctr is set to", ctr)) + ctr <- ctr + 1 # Increment ctr + }
[1] "ctr is set to 1" [1] "ctr is set to 2" [1] "ctr is set to 3" [1] "ctr is set to 4" [1] "ctr is set to 5"
> # TEMPLATE for while loop > while(condition){ + expression + }