Since the index/iterator is hidden in the foreach
construct, you can draw your CFG loops similarly to how a tool like staticfg would do (for Python), with a label indicating the array you are iterating on. You don't need to expose an internal index. Your CFG would look like: