Hacker News new | ask | show | jobs
by UIZealot 2143 days ago
> "Clean this item and put it away. Then do that for every other piece of cooking equipment."

Without the "do" it's nonsensical. And that was exactly my point.

2 comments

I think there's an argument that "do" is just a placeholder for the body of the loop, i.e. "clean this item and put it away". If you flip the order that the body and the iteration are expressed so that it reflects what most programming languages use for syntax, it would be "for each piece of cooking equipment, clean it and put it away". There's no "do" here, nor is it needed.
There you need the word "each" to convey that it's a loop.

I'd certainly agree that "for each" is much better than "for" alone.

That was just one way of phrasing it. You could just as easily put it as, "For every piece of cooking equipment, clean it and put it away."
There you need the word "every" to convey that it's a loop.

I'd certainly agree that "for each" is much better than "for" alone.

"Do your homework" doesn't imply a loop either. Nor does "This could take a while"

It should not be a shock that the english language doesn't naturally have a single word that can express both a condition/duration as well as a command without any other helper words.

Do is superfluous. Everything in an imperative program is a request to do something.

> "Do your homework" doesn't imply a loop either.

But "for these subjects, do your home work" does.

> Nor does "This could take a while"

I never claimed that "while" alone is any better.

> It should not be a shock that the english language doesn't naturally have a single word that can express both a condition/duration as well as a command without any other helper words.

I never asked for a magic word. To the contrary, I was lamenting the lost of the helper word "do", making the "for" alone nonsensical.

> Do is superfluous. Everything in an imperative program is a request to do something.

I disagree. I think "for...do" makes things much clearer than "for" alone.