ordelore wrote:
You don't need a return or an end because a return signifies the end of a subroutine and/or the program. Axe will automatically add the return. an end is not necessary.
The "End" is indeed unnecessary but the return at the end is still a good idea to put, to avoid getting bad habits. Axe won't add a Return if there is already one so you don't waste space (but in the present case, not only the "End" is useless but a "Return" is added too).
GinDiamond wrote:
What the heck is going on with this code? I compiled it today with no changes with the last compilation, yet it exits as soon as it starts.
Code:
I have a feeling the Return is doing something. Am I right?
Have you just tried in our mind what your program does ? Have you noticed that you put your subroutine inside your main loop ? Have you thought about indenting your code to avoid such mistakes ?
Code:
<snipped>
I have a feeling the Return is doing something. Am I right?
Because the problem is quite simple:
-the program reads the "Repeat getKey(15)" and doesn't quit since you don't hold the Clear key
-it reads the bunch of "If/ElseIf/..." and changes X and Y accordingly
-It hits the "End" of the "If"
-It does the sub(CS) and DispGraph and the sub(CS) again.
-then it enters the Lbl CS
-it Pt-Changes
-it hits Return and quits
-all of this happened so fast you thought nothing happened
-it never reads the "End" at the end, nor the "Return" that is automatically added
How to fix the problem:
I guess you should just move the "End" of the End and put it right after the second sub(CS). You could also add a Return right after it, to avoid getting bad habits, but at worst, the program will Pt-change for nothing then quit after it hits the End of the loop.
And as I said, code indenting helps, because if you had tried to indent your code, you'd have noticed that your routine is inside the loop.