04-01-2005, 08:49 AM
url=http://www.random-seed.net][/url]
functions or subs?
|
04-01-2005, 08:49 AM
url=http://www.random-seed.net][/url]
04-01-2005, 09:11 AM
To be honest you can do either one. But the general idea is that if the routine returns something back to you (e.g. a calculated value, an error message, anything really) its a function. If it just does something and then comes back to the calling code, its a sub. Some languages (C for example) don't really have a difference (a sub is a function that doesn't return anything, it returns a VOID).
So for your 3d cube, my first gut thought would be to say a sub. BUT, if you want to return an error code (e.g. if it would be drawn offscreen for example) then maybe a function. If you have to ask (because you are a beginning programmer, no insult meant) then go always go with a sub unless you KNOW you need to make a function. Why? Because its easier to go with a set rule until you understand why not to :-). |
« Next Oldest | Next Newest »
|