Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

nextElem

Get Next Element of Iterator


Description

nextElem is a generic function used to produce values. If a checkFunc was specified to the constructor, the potential iterated values will be passed to the checkFunc until the checkFunc returns TRUE. When the iterator has no more values, it calls stop with the message 'StopIteration'.

Usage

nextElem(obj, ...)

## S3 method for class 'containeriter'
nextElem(obj, ...)
## S3 method for class 'funiter'
nextElem(obj, ...)

Arguments

obj

an iterator object.

...

additional arguments that are ignored.

Value

The value.

Examples

it <- iter(c('a', 'b', 'c'))
  print(nextElem(it))
  print(nextElem(it))
  print(nextElem(it))

iterators

Provides Iterator Construct

v1.0.13
Apache License (== 2.0)
Authors
Michelle Wallig [cre], Revolution Analytics [aut, cph], Steve Weston [aut]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.