Using GOTO is bad on many levels. Lets say, for example, that I said "GOTO Post-109423" to get your answer. Where would you reply? That thread?, this original thread? or some other thread entirely?
GOSUB is a little bit better, and a good way to get used to functions. I could say "GOSUB Post-109423" to get more info, but when you're done reading that post, RETURN to the original post. GOSUB calls a SUBROUTINE by name that performs some task and returns to the original location (line following the gosub, actually). GOSUBs are OK, but you can't exchange data with them. They are part of the main program and have no isolation of variable names or data. Subroutines MODIFY THE ORIGINAL DATA.
Functions are the best because they provide a completely isolated environment - you can pass data to a function and it will get a COPY of the data. It can perform calculations and manipulate that data any way it wants without affecting the original data. You can return a COPY of the function's data back to the main program (where it can replace its copy with the modified data if you choose). Functions can also return result codes via EXIT, which can be checked by examining @ERROR, making it easy to tell if a function did its job successfully or not.
I'll post some code that will provide a few simple examples later this evening.. You should get the concept more clearly from those.
Glenn
_________________________
Actually I
am a Rocket Scientist!