Google News
logo
R - Interview Questions
Define repeat loop
Repeat loop executes a sequence of statements multiple times. It doesn’t put the condition at the same place where we put the keyword repeat.
 
Example :
>name <-c(“Peeter”,”Danny”)
>temp <-5
> repeat {
print(name)
temp <- temp +2
if(temp >11){
Break
}
}
This would return the name vector four times. First, it prints the name and increases the temperature to 7 and so on.
Advertisement