Having a bug for my lerp animation sequence

Yeah, here’s some tips to keep your code organized and clean:

  • Whitespace is key. Use proper indentation - a single additional indent for each if/else/elseif statement, for/while/repeat loop, function definition, or anything else that encloses a code segment
  • Don’t use unneccessary language. For example, if you want to check if something is true, you don’t need to write out if value == true then, you can simply put if value then (this also applies to the opposite with if value == false then and if not value then)
  • Add extra lines where necessary to separate out different key parts of your process. For example, in the code we’ve been working with, I added a space between the first set of values, the wait line, and the second set of values, to show all three ‘stages’ of the function
  • Follow the general structure of variable definition first (grouping variables by type, like strings with string, integers with integers, etc.), followed by the rest of your code
  • Stay generally clean and concise, using descriptive variable names where possible

There are plenty more guidelines and rules to code styling (to the point of near religion in some places) that vary depending on company, language, and user, but these are a good place to start.

1 Like

That’s very useful maybe you should put a community resource thread for it because it will help for people like mine.

1 Like