Check out example codes for "rust for vs for_each". It will help you in understanding the concepts better.

Code Example 1

This is equivalent to using a for loop on the iterator, although break and continue are not possible from a closure.  It's generally more idiomatic to use a for loop, but for_each may be more legible when processing items at the end of longer iterator chains.  In some cases for_each may also be faster than a loop, because it will use internal iteration on adaptors like Chain.

Learn ReactJs, React Native from akashmittal.com