Questions about the BASICtools and MakeItC
Post Reply
Posts: 394
Joined: Sat May 17, 2014 4:22 pm
Location: South Carolina


Post by olzeke51 »

BasicChip - mornin'
Ran into an issue with a FUNCTION(or a SUB) inside a SUB - is it legal??
"I was hoping to keep everything in the SUB task3 - so it could be transferred easily"
the following statements would imply [to me] that it is possible
Help File re: SUB says this"
Code labels for goto/gosub declared within the SUB procedure are also in the local scope. "
[am I misinterpreting 'Code labels for goto/gosub declared within '??]

Help File re: FUNCTION
"FUNCTIONs are an extension of SUB that will return a value. "
BTW if I move the FUNCTION outside of the SUB it works
' and the 'GOTO work3 will jump over some following code.
Thanks for clarifying this - Gary
code and compile results
code and compile results
FUNC_in_SUB_err.gif (228.99 KiB) Viewed 596 times

Posts: 1029
Joined: Fri Oct 19, 2012 2:39 am
Location: Lake Tahoe, CA

Re: embedded FUNCTION/SUB

Post by basicchip »

nested FUNCTION or SUB are NOT allowed in BASIC, not sure I have ever seen that in any BASIC

Labels within FUNCTION/SUB are local to that FUNCTION/SUB. That is the way symbols are handled.

Post Reply