I'm designed a flowchart to describe at a high level how a programming process works. Part of this process involves looping through a set of items. I'm wondering if there is any standard or semi-standard way of representing a "for each" style loop in a flow chart, that does not involve making the iteration explicit with an iteration box like m = m + 1
(e.g. here). Most modern programming languages have some kind of "for each" construct for enumerating a set or sequence of items, without having to think about indices. I'm basically looking for a similar visual construct for a flow chart, to avoid wasting space with an explicit counter increment.

- 10,479
- 26
- 77
- 126
-
2I don't think there is a flowchart specifically designed for for..each loop since it was designed before such concept began. However, you could probably represent it same as the regular for loop, however instead of the standard increment say `i=i+1`, it would be `Get the next Item of the Collection`. – Edper Dec 14 '13 at 05:42
5 Answers
Sooo I know this topic is now 3 years old, but it might help others. I found a little trick to represent a "for each" loop in a UML flowchart. I don't think it is standart, though I find it quite instinctive.
Here it is :
-
4Too bad the image is not directly visible/embedded on Stackoverflow, but I like this answer best for its simplicity. – jfritz42 Feb 22 '19 at 21:57
I had the same question and found the answer here.

- 683
- 1
- 10
- 24

- 10,701
- 5
- 53
- 53
Mendix is a rapid application development platform where most of the logic resides in so-called 'microflows', which are represented by flowcharts. Here is an example how it represents a 'for each' loop:
It's similar to @user21715's answer, but it uses the same 'parameter' pentagon which is also used to denote input parameters for a flow, with a 'loop' icon. The small gray circle is the end of the loop iteration (similar to continue
in most languages); they have an orange one for a break
(a premature end of the loop). The first and last statements in a loop are recognizable by having no incoming resp. outgoing arrow.

- 21,988
- 13
- 81
- 109
Here's an example I found that seems pretty intuitive. I have no idea if this is a standard practice, but it looks good to me.
Sorry about the resolution. The important parts are that the parallelogram on the left says "Listof numbers", the diamond in the middle says "For each", the arrow going down and to the right of the diamond says "Each Number", and the arrow going straight down from the diamond says "End of list"

- 908
- 1
- 8
- 28
-
Hmm... Looks like the image I linked to has moved. Unfortunately, I don't really remember what it looked like. I'll see if I can find it again somewhere and if not, I'll delete my answer. – NateW Nov 14 '19 at 21:15
-
1The original link (http://svgur.com/s/zA) shows an X in a circle now. However, fortunately, it seems that google image search has cached the thumbnail of the original image, so I've just posted a screenshot of that thumbnail. It's lower resolution, but it gets the point across. – NateW Nov 14 '19 at 21:27
I've done that by setting an initial variable N=numberOfItems, and the rest is history ;) (i.e. a conventional "for" loop).

- 393
- 4
- 8