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

I'm new to Zig but I think this is how you would do it:

    {
        var i: usize = 0;
        while (i < 10) : (i += 1) {
            // use i
        }
    }


Looks like a solution, a bit annoying to introduce an extra block.


Yeah. And it fails the "make the easy way the right way" test of language design.


I give a c-like for loop (or while loop) a 40% odds of making it into the language. That number being pulled out of my nether regions.




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

Search: