Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do I know When To Use Return() In My Scripts To Get Better Organization?

Asked by 5 years ago

I understand how returns work and how you can use it to call later. My problem is how will I know when to use return effectively and then lead to a better organization with my code?

0
What I like to do it is declare the variable/s I will be returning at the start of my function without giving them a value, write up the function's code that will potentially change said variable/s value, and have a single 'return' at the end of the function followed by the mentioned variable/s. Le_Teapots 913 — 5y
0
I was looking at some more advanced scripts than mine on a game, and now that you mention it I do see a pattern with local variables and such. I do want to see what others point of view and how they go about it as well. Sonicbulletwolf1 6 — 5y
0
There are many ways to actually call return, you can easily just call return end and it does nothing. Another common one is return end and it will work. Nicholas1088 169 — 4y

Answer this question