Questions about the BASICtools and MakeItC
Post Reply
Posts: 414
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 5088 times

Posts: 1090
Joined: Fri Oct 19, 2012 2:39 am
Location: Weeki Watchee, FL

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.

Posts: 1
Joined: Wed Feb 23, 2022 4:56 pm

Re: embedded FUNCTION/SUB

Post by jackma »

it is not proper way to define function inside a function that's why it is not working when you are defining inside the other function
code pro zone
. check algorithm of function.

Post Reply