Skip to content

Instantly share code, notes, and snippets.

@jeremyyeo
Created September 27, 2016 02:54
Show Gist options
  • Save jeremyyeo/9160121189fddfda7527fea30d95b97d to your computer and use it in GitHub Desktop.
Save jeremyyeo/9160121189fddfda7527fea30d95b97d to your computer and use it in GitHub Desktop.
x <- 1
for (i in 1:10) {
while (x < 5) {
print(x)
x <- x + i
if (x >= 5) {
break
}
}
if (i >= 5) {
print(paste("I have broken out of the while loop", i, "times"))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment