PC-BASIC version: 2.0.4
I get a strange result when entering a program in a Session and the GOSUB to a specific line. Here is a small test case:
#!/usr/bin/env python3
import pcbasic
SOURCE = """\
10 PRINT "Main"
30 PRINT 42
40 END
50 PRINT "After End"
60 PRINT "Sub"
70 RETURN
"""
def main():
with pcbasic.Session() as session:
session.execute(SOURCE)
# session.execute("RUN")
session.execute("GOSUB 60")
if __name__ == "__main__":
main()
The output I get:
What I expected was just the "Sub" without the 42 from line 30. And extra confusing is that "Main" is not printed. So why is the RETURN apparently jumping to line 20 instead of just return to the ”prompt” like it is done if the program and the GOSUB is entered manually?
PC-BASIC version: 2.0.4
I get a strange result when entering a program in a
Sessionand theGOSUBto a specific line. Here is a small test case:The output I get:
What I expected was just the "Sub" without the 42 from line 30. And extra confusing is that "Main" is not printed. So why is the
RETURNapparently jumping to line 20 instead of just return to the ”prompt” like it is done if the program and theGOSUBis entered manually?