• schnurrito@discuss.tchncs.de
    link
    fedilink
    arrow-up
    4
    ·
    19 hours ago

    You can have a non-infinite loop without a break statement, you just need a return statement in it. Also for(;;) is much faster to write than while(true).

    • TwilightKiddy@programming.dev
      link
      fedilink
      English
      arrow-up
      1
      ·
      10 hours ago

      Yes, but the latter is easier to read. I know what the former is, but my colleague could definitely use additional brain cells. And if they don’t understand it, I’ll be the one explaining. That’s also the reason for not using abbreviations besides the most common ones in variable names. Always assume your code will be read by a typewriter monkey.