The for-statement executes the statements enclosed in braces N times, where N is the number of values in vector-expression. Each time the statements are executed variable is set to the kth value of vector-expression, where k = 1… N.
for ( variable in vector-expression )
{
statements
}
> for ( i in 1:3 ) { i } i = 1 i = 2 i = 3
vector-expression can be any type of vector: real, complex, and string vectors are all acceptable.