logoalt Hacker News

MaulingMonkey • today at 1:14 AM • 2 replies • view on HN

I prefer:

    const size_t n = 10;
    for (size_t i = n; i --> 0;) {
        std::cout << i << "\n";
    }

Replies

hedgehog • today at 1:23 AM

That's a certain kind of taste... I checked out your home page, game dev, check, and this work of art is worth linking (no irony, I love it):

http://maulingmonkey.com/brainfuck/

➕ show 1 reply
ranger_danger • today at 1:23 AM

Cute but wouldn't work with ssize_t :)

VHDL's array/vector syntax actually works a similar way:

-- gives 0, 1, 2, 3:

for i in 0 to 3 loop

-- gives 3, 2, 1, 0:

for i in 3 downto 0 loop

-- Source - https://stackoverflow.com/a/7642026 -- Posted by Kerrek SB -- Retrieved 2026-10-29, License - CC BY-SA 3.0

➕ show 1 reply