Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> C should have only one loop keyword loop{}

How do you implement do while loops? Also I find the niceties of for loops a good improvement. You are able to limit the scope of variables to only the loop, while still being able to use it in the condition, and it separates the transition from the real loop code. I think idiomatic in C is the overuse of for, resulting in while used really seldomly.

What else do you think is really excessive in syntax alone?



> How do you implement do while loops?

    loop {
        ...body
        if (condition)
            break;
    }


What is the benefit over this:

    loop: {
        ...body
        if (!conditon)
            goto loop;
    }
What separates loop syntax from goto is explicit syntax for the condition. When you give that up, why do you have loop at all?


Shouldn't your body be after the condition check?

Otherwise you get one iteration even if your condition was false to begin with?


I specifically asked for a do while loop.


Oh wow. My brain entirely ignored the second do in that sentence.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: