How To

“SUB CANNOT BE NESTED”....new error. Solution?

1

Alice 2020-11-18 04:36

New issue...

I have one sub for each letter of the alphabet...and a sub that selects what “action” was selected (IFs that select the right SUB according to the proper INKEY$)...but I get the error at the letter “W” sub.

Ideas?


nathanielbabiak 2020-11-18 04:40

I think you'll find that omitting a closing END IF can throw super weird errors.

(I presume you know one SUB can't have another sub defined inside it - there needs to be an END SUB instruction between them.)


nathanielbabiak 2020-11-18 04:42

Also, did you know you can attach code files to forum posts? For long or specific things, it's much better than discussing generalities (or copy-pasting into the forum post body text).


Alice 2020-11-18 04:55

...checked the END SUBs...not the issue...it’s in the middle of a list with almost identical lines. Commented out the SUB with the error...but the next one has the issue...like a limit. It’s working with a GOSUB...RETURN but that’s going to be an issue later.


Alice 2020-11-18 05:15

Must have been a coding typo...flipped all the GOSUBs and RETURNs back to SUBs and END SUBs and everything worked. I was also using GO_HERE: ...which shouldn’t have done anything since labels don’t do anything except bookmark the code line (uses a variable?) so I commented them out.

...not sure...but it’s fixed and that’s what matters.

Thanks guys.


Log in to reply.