Hacker News new | ask | show | jobs
by WalterBright 17 days ago
If you prefer writing:

    for (auto&& [i, it] : vec | std::views::enumerate)
        println ("{}:{}", ++i, it);
instead of:

    foreach (i, s; vec)
        writeln(i, ": ", s);
well, what can I say?
2 comments

I prefer to use the option with better market share.

I am not counting characters, especially when AI completes typing for me.

We may first need to go over what "elegant" means I guess. :)
There is elegant when writing code by hand, and when reviewing code by AI agents.