Iterating

  • each_entry: Calls the block with each successive element (slightly different from each).
  • each_with_index: Calls the block with each successive element and its index.
  • each_with_object: Calls the block with each successive element and a given object.
  • each_slice: Calls the block with successive non-overlapping slices.
  • each_cons: Calls the block with successive overlapping slices. (different from each_slice).
  • reverse_each: Calls the block with each successive element, in reverse order.