Just a note in the hope that it may help clear up confusion in the future. It will probably be me that gets confused (again) but may help someone else too.
I had the need to compile a program to replace a chip that had failed in active service after a few years.
The program was originally written and compiled in 2019. From the notes, I had made a slight update during June 2024 so it compiled then too.
I came to flash it and the compiler returned an error:
That pointed to this Subroutine, specifically the "End Sub" line.
SubShowNameMessageCheck_SwitchesIfSwitchValue=SwUPThen' 0123456789012345Get_Ticket_ValuesPrint"Bon: Gsw: "'Show the valuesLocate0,4Print(Acc_T_Value)Locate0,12Print(GamesSinceWin)ReturnEndIf#IfnDefLuckyDrop' 0123456789012345Print" Lucky Dip "'Show the splash screen#EndIf#IfDefLuckyDrop' 0123456789012345Print" Lucky Drop "'Show the splash screen#EndIfEndSub
I could see that the Sub was "declared" correctly and so was a little confused. Especially as it was a working program.
Eventually I spotted the "Return" statement a few lines above "End Sub".
Replaced "Return" with "Exit Sub" then the program compiled and flashed as expected.
SubShowNameMessageCheck_SwitchesIfSwitchValue=SwUPThen' 0123456789012345Get_Ticket_ValuesPrint"Bon: Gsw: "'Show the valuesLocate0,4Print(Acc_T_Value)Locate0,12Print(GamesSinceWin)ExitSubEndIf#IfnDefLuckyDrop' 0123456789012345Print" Lucky Dip "'Show the splash screen#EndIf#IfDefLuckyDrop' 0123456789012345Print" Lucky Drop "'Show the splash screen#EndIfEndSub
Obviously the use of "Return" to jump out of a Subroutine is no longer permitted.
Had me going for too many minutes...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
✅ Context
Recent releases tightened syntax and logic checking. The Return keyword was preventing the compiler from fully checking subroutines for completeness. As a result:
The use of Return to exit a Subroutine is no longer permitted.
This change is correct and necessary.
💡 Improved Error Message Proposal
Instead of the current:
Missing Sub definition, or, missing GoSub definition
Consider updating messages.dat under MissingSubDef to:
MissingSubDef="Missing Sub definition, missing GoSub definition, or missing End Sub (Note: 'Return' can no longer be used to exit/end a Subroutine)"
Can this be made better? Edit your messages.dat file. Find 'MissingSubDef' and use the line above. Recreate the condition, then edit the text until your are happy and then repost to this thread.
👍
1
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Just a note in the hope that it may help clear up confusion in the future. It will probably be me that gets confused (again) but may help someone else too.
I had the need to compile a program to replace a chip that had failed in active service after a few years.
The program was originally written and compiled in 2019. From the notes, I had made a slight update during June 2024 so it compiled then too.
I came to flash it and the compiler returned an error:
That pointed to this Subroutine, specifically the "End Sub" line.
I could see that the Sub was "declared" correctly and so was a little confused. Especially as it was a working program.
Eventually I spotted the "Return" statement a few lines above "End Sub".
Replaced "Return" with "Exit Sub" then the program compiled and flashed as expected.
Obviously the use of "Return" to jump out of a Subroutine is no longer permitted.
Had me going for too many minutes...
Yes, great help to everyone.
✅ Context
Recent releases tightened syntax and logic checking. The
Returnkeyword was preventing the compiler from fully checking subroutines for completeness. As a result:This change is correct and necessary.
💡 Improved Error Message Proposal
Instead of the current:
Consider updating
messages.datunderMissingSubDefto:Can this be made better? Edit your messages.dat file. Find 'MissingSubDef' and use the line above. Recreate the condition, then edit the text until your are happy and then repost to this thread.
Thanks, I figured it out and had a vague memory that "Return" had been deprecated as a method of returning from a subroutine.
I posted to remind myself as much as anything. Should anyone else search the forum in confusion, my post might give them an indicator too.
Please try the update to the message.dat
See if the error message is better.