• @Omgpwnies@lemmy.world
    link
    fedilink
    English
    122 months ago

    Break it up into functions with names that describe what it does, then the script becomes basically a sequence of function calls and is easier to read and troubleshoot.

    • Radioactive Butthole
      link
      fedilink
      English
      62 months ago

      This is how I started writing my scripts and it is sublime. Even better is when your function can be a single return statement, makes writing tests easy.

    • @1984@lemmy.today
      link
      fedilink
      9
      edit-2
      2 months ago

      Yeah I dont know why people dont do this. Then an overall description of the script at the top is enough and anyone can just look at function names to see what is going on.