• 3 Posts
  • 30 Comments
Joined 1 year ago
cake
Cake day: June 15th, 2023

help-circle








  • p1mrx@sh.itjust.worksto196@lemmy.blahaj.zonefixed rule
    link
    fedilink
    arrow-up
    0
    ·
    edit-2
    5 months ago

    GNU style is logical, because braces are syntactically a single statement:

    while (x == y)
      func1();  // can be replaced by { ... }
    

    However, I prefer to entirely avoid unbraced single statements after while/if:

    while (x == y) {
      func1();  // easy to add func2(); later
    }
    

    Although this is ok when it fits:

    while (x == y) func1();  // brevity!