Iterators ========= ```Example from 1 languages: Python https://www.w3schools.com/python/python_iterators.asp ``` ```Example from 1 languages: Java Iterator iter = list.iterator(); //Iterator<MyType> iter = list.iterator(); in J2SE 5.0 while (iter.hasNext()) { System.out.print(iter.next()); if (iter.hasNext()) System.out.print(", "); } ``` ```Example from 1 languages: C++ std::vector<int> items; items.push_back(5); // Append integer value '5' to vector 'items'. items.push_back(2); // Append integer value '2' to vector 'items'. items.push_back(9); // Append integer value '9' to vector 'items'. for (auto it = items.begin(); it != items.end(); ++it) { // Iterate through 'items'. std::cout << *it; // And print value of 'items' for current index. } ``` ```Example from 1 languages: Ruby (0...42).each do |n| puts n end ``` ```Example from 1 languages: Rust for n in 0..42 { println!("{}", n); } ``` ```Example from 1 languages: MATLAB % Define an array of integers myArray = [1,3,5,7,11,13]; for n = myArray % ... do something with n disp(n) % Echo integer to Command Window end ``` ```Example from 1 languages: Chapel iter ``` ```Example from 1 languages: Speedie || items = [5,6,7,8] for i in items printline i ``` * Languages *with* Iterators include Python, Java, C++, Ruby, Rust, MATLAB, Chapel, Speedie * Languages *without* Iterators include progsbase * View all concepts with or missing a *hasIterators* measurement http://pldb.info/../lists/explorer.html#columns=rank~id~appeared~tags~creators~hasIterators&searchBuilder=%7B%22criteria%22%3A%5B%7B%22condition%22%3A%22null%22%2C%22data%22%3A%22hasIterators%22%2C%22origData%22%3A%22hasIterators%22%2C%22type%22%3A%22num%22%2C%22value%22%3A%5B%5D%7D%5D%2C%22logic%22%3A%22AND%22%7D missing http://pldb.info/../lists/explorer.html#columns=rank~id~appeared~tags~creators~hasIterators&searchBuilder=%7B%22criteria%22%3A%5B%7B%22condition%22%3A%22!null%22%2C%22data%22%3A%22hasIterators%22%2C%22origData%22%3A%22hasIterators%22%2C%22type%22%3A%22num%22%2C%22value%22%3A%5B%5D%7D%5D%2C%22logic%22%3A%22AND%22%7D with * Read more about Iterators on the web: 1. https://en.wikipedia.org/wiki/Iterator 1. Built with Scroll v178.2.3