Putting a backslash after a part of the statement basically means ignore any newlines between this and the next characters so you can indent it however you want

  • astrsk@fedia.io
    link
    fedilink
    arrow-up
    11
    ·
    2 days ago

    This is one of the reasons why I don’t like gdscript. I get that it’s based on python and interpreted but I will never enjoy alignment sensitive languages. Just let me format it how I want and control EOL with semicolons.

    On a related note, might be cool to see some tips on the mono side of things here :)

    • GreyBeard@lemmy.one
      link
      fedilink
      arrow-up
      4
      ·
      1 day ago

      Of course it’s a matter of personal preference, but I’m exactly the opposite. I’m ending a line by hitting the enter key, why should I have to go through the trouble of hitting the ; key for every single line, when more often than not I’m not breaking single lines up to multi-line. On those rarer occasions I can use \ key. It probably helps that I was “raised” on a white space sensitive language. But to me, it makes way more sense to let the whitespace mean the same thing to the computer that it does to me.

      All of that said, I’m still wrapping my if statements in () though. I don’t care if is not required. Just looks better to me.

  • QuazarOmegaA
    link
    fedilink
    arrow-up
    15
    ·
    2 days ago

    Good to know, but this goes in the TIHI category, what’s that indentation? 👀

  • Mikelius@lemmy.ml
    link
    fedilink
    arrow-up
    1
    ·
    1 day ago

    I tend to us the backslash syntax for longer if statements. One thing I do differently than documention mentions though is double tab the following lines in my if statements. Keeps it easier to read where it ends and where the actual code block begins.