1

I have a subroutine which fills an array with "."s

In my main program I am trying to call this subroutine and then print the array; however, it doesn't seem to be working. I think I am incorrectly calling the subroutine?

This is my code:

subroutine:

1070 dim a$(x,x)
1080 for aa = 0 to x
1090 for bb = 0 to x
2000 a$(x,x)="."
2010 next
2020 next

main code:

10 input "please enter a number"; x
20 gosub 1070
30 for i = 1 to x
40 for j = 1 to x
50 print a$(i,j);
60 next
70 print
80 next

Nothing happens when run; but when I run it all in one program (not calling gosub) it works?

Any help?

4

1 回答 1

2

在#2000 行,我相信你想要a$(aa,bb)=".",否则你只是在初始化时敲击相同的位置。

此外,对于您的问题可能更重要的是,每个人都GOSUB需要RETURN回到执行的主线。在您的情况下,这可能是第 2030 行。

于 2014-03-20T21:37:46.030 回答