Remix.run Logo
mrkeen 5 days ago

It's implied by void-returning do-something-with(...).

Otherwise you're just burning cycles and a good compiler should dead-code eliminate the whole loop.

(see https://news.ycombinator.com/item?id=44873488)

gpderetta 4 days ago | parent [-]

We are discussing mutation in the loop itself, but sure:

  for(int x: container) {
      yield frob(x);
  }