...

/

while Loops

while Loops

In this lesson, we will learn all about the while loop in R language.

The simplest kind of loop in the R language is the while loop.

It is simply translated as: "if the given condition is satisfied then execute the statements in the while block and if the condition is not satisfied break the loop (which means the block of code in the curly brackets { } will not be executed).

Syntax of a while loop

The syntax for while loop in R:

 ...