This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
live4evil's profile picture

Benefit to using local variables?

Started by live4evil, 01 March 2012 - 03:19 AM
live4evil #1
Posted 01 March 2012 - 04:19 AM
I was wondering what the benefit is in using local variables compared to global ones?
Luanub #2
Posted 01 March 2012 - 04:25 AM
See this thread, its got some pro's listed. http://www.computercraft.info/forums2/index.php?/topic/336-question-about-user-input-into-prints/page__fromsearch__1

For the most part, local vars are block specific which will help you avoid conflicts between other programs. They are slightly faster, so on and so forth.

Its always best to use local vars where you can.