Eventually, I realized that it would make more sense to create functions, as it was becoming a bit of a mess to navigate.
100%. Small code is sooooo much better than a mess to read. Writing is honestly easier sometimes than reading.
Eventually, I realized that it would make more sense to create functions, as it was becoming a bit of a mess to navigate.
100%. Small code is sooooo much better than a mess to read. Writing is honestly easier sometimes than reading.
Yeah, I quickly learned that, lol.
How do you usually decide what to make a function? Is there a certain rule that you follow?
If anything needs to be repeated more than once it becomes a function. Quite possible the easiest way to decide. Either that or when things get too messy to read and I need to split it up into smaller chunks.
That makes a lot of sense, actually. I'll try and follow that going forward. I've also noticed that repeated code lends itself to more errors popping up.
You get the nice and easy part of fixing it once means its fixed everywhere :)