R TutorialLesson 14Free preview
R While Loop
This lesson is part of R · All levels
Summary
This lesson reviews the 'while' repetition in R that executes the block of code repeatedly during the evaluation condition of the value TRUE. The developer will learn how to set the repeat control variable, use the keyword 'break' to stop the loop, and 'next' to jump to the next iteration.
Key points
- The repetition of 'while (condition) ' runs during the value of the condition
- Conditions are evaluated before each iteration round begins
- The keyword 'break' is used to forcefully stop repetition
- The keyword 'next' leaps over the rest of the code in the current iteration (similar to 'continue' in other languages)
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.