Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Skip and take from an iterator

  • skip
  • take
fn main() {
    let taken = (0..).skip(5).take(7).collect::<Vec<_>>();
    let range = (5..12).collect::<Vec<_>>();
    assert_eq!(taken, range);
    println!("{:?}", taken);
}
[5, 6, 7, 8, 9, 10, 11]