• GNU/Dhruv@lemmy.ml
    link
    fedilink
    arrow-up
    6
    ·
    1 year ago

    Is this some kind of python meme I’m too C++ to understand?

    Now, I’m completely willing to start a war about { going on the next line.

    • Eavolution@kbin.social
      link
      fedilink
      arrow-up
      5
      arrow-down
      1
      ·
      1 year ago

      It goes on the line! If you put it below, you’re wasting a line for no extra readability!

      • GNU/Dhruv@lemmy.ml
        link
        fedilink
        arrow-up
        5
        ·
        1 year ago

        It goes on the next line, so you can have open and close brackets at the same indent depth for easy visual matching.

        • Steeve@lemmy.ca
          link
          fedilink
          arrow-up
          2
          ·
          1 year ago

          Your closing } goes on a new line below at the same indent depth as the line containing the open {!

        • TheInsane42@lemmy.ml
          link
          fedilink
          arrow-up
          1
          ·
          1 year ago

          This, as it also helps when using % to go to the matching open/close bracket when the cursos doesn’t jump all around the place…

    • TheInsane42@lemmy.ml
      link
      fedilink
      arrow-up
      3
      ·
      edit-2
      1 year ago

      Totally agree, all my { end up on the next line, 1st spot when starting a function, last character of the keyword when starting an if/for/… section. I even put the closing one on the same line when it’s single line, else either at the end of the closing line (when changing really old code) or same indent.

      So indenting varies a lot, which makes most ‘new’ programmers go mental.

      while (my code)
          { I'll do it my way }
      
      if (! liked)
       { toughen-up }
      else
       { get used to it
         multi-line can go both ways...
       }
      

      That is, unless the font used messes it up. ;)

    • Saigonauticon@voltage.vn
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      Wonder what the x-axis is? Survey year? Years of experience? Caffeine intake?

      Anyway, I can hardly join a holy war – I code in assembly most comfortably, which I’m pretty sure is heresy these days.