This help topic is for R version 0.60. For the current version of R, try https://stat.ethz.ch/R-manual/R-patched/library/base/html/Control.html
Control {base}R Documentation

Control Flow

Description

These are the basic control-flow constructs of the R language. They function in much the same way as control statements in any algol-like language.

Usage

if(cond) expr
if(cond) cons.expr  else  alt.expr
for(var in seq) expr
while(cond) expr
repeat expr
break
next

See Also

ifelse, switch.

Examples

for(i in 1:5) print(1:i)

[Package base version 0.60 ]