Nothing
context("Break in loops")
test_that("break in simple loops", {
f <- function() { for (i in 1:10) { 1; break; 2 } }
expect_equal(cyclocomp(f), 4)
f <- function() { for (i in 1:10) { 1; 2; break } }
expect_equal(cyclocomp(f), 3)
})
test_that("break in the loop condition", {
f <- function() {
for (i in 1:2) {
for (j in { break; 1:10 }) {
"foobar"
}
i
}
i
}
expect_equal(cyclocomp(f), 6)
f <- function() {
for (i in 1:2) {
for (j in 1:10) {
break
"foobar"
}
i
}
i
}
expect_equal(cyclocomp(f), 6)
})
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.