1×
Become a member
to unlock all features

Create an egghead account to access 5000+ tutorials and resources from expert developers.

Create account
Autoplay

    Rustlings iterators2: Introducing Iterators by manually calling .next and using .iter()

    rustRust

    README for this exercise.

    input.chars() returns an iterator that we manually iterate through using .next().

    Later in the program we take advantage of .iter() and the turbofish to reuse the same code across two different use cases.

    Also note that an alternative solution is possible where the character uppercase function returns an iterator that is then collected()