Quantcast
Viewing all articles
Browse latest Browse all 4

Answer by Spartan301

A function is not a way to store data, it stores a section of code so that it can be used again repeatedly with ease. For example if I have a gameObject that I want to move to a new location each time it is hit, then I would create some code that would do that, and place that code inside a function, for example, function ResetPosition(){...}. Then whenever I needed to reset the objects position, I could just write ResetPosition(), instead of writing the entire code segment again. Hope this helps. In short, variables are meant to store small data pieces, like a number or a word, while functions store and execute sections of code. Hope this helps.

Viewing all articles
Browse latest Browse all 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>