What is the correct syntax for a while loop in R?

What is the correct syntax for a while loop in R?

a) while condition do
b) while(condition)
c) while condition
d) while{condition}

Answer:

b) while(condition)

Explanation:

The correct syntax for a while loop in R is while(condition), where the condition is checked before each iteration.

Reference:

R Programming – Loops MCQ Questions and Answers

Scroll to Top