# create an iterator that counts from 1 to 3.
it <- icount(3)
nextOr(it)
nextOr(it)
nextOr(it)
nextOr(it, NULL) # expect NULL
x <- icount(5)
repeat print(nextOr(x, break))
it2 <- icount(100)
all.equal(as.numeric(it2), 1:100)
as.list(icountn(c(2, 3)))
Run the code above in your browser using DataLab