DEV Community

How I learned to Stop Looping and Love the Iterator

Kushan Joshi on May 30, 2018

Let us all take out a minute from our busy lives to look at past and think how many hours did we waste fixing that for loop. If your memory returns...
Collapse
 
dance2die profile image
Sung M. Kim

Thanks @kepta for the wonderful article.
I am able to see "why" iterators be so useful with those 4 "superpowers" 😀

Regarding iterator vs iterables, the way I understood is that,

  1. iterables are objects that can be iterated over
  2. so that means iterable objects return an iterator object with which we can iterate.

Did I understand it correctly?

Collapse
 
kepta profile image
Kushan Joshi

You got that damn right !

Collapse
 
dance2die profile image
Sung M. Kim

Thanks Kushan 👍

Collapse
 
bjhaid_93 profile image
/[Abejide Femi Jr]\s/

Nice article Kushan

Collapse
 
shmdhussain12 profile image
Mohamed Hussain

Thanks for the article....learned from it

Collapse
 
martyonthefly profile image
Sylvain Marty

Very helpful, thank you Kushan 👌