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?
In line #2000, I believe you want a$(aa,bb)="."
, otherwise you're just hammering the same location with the initialization.
Also, and probably more important to your question, every GOSUB
needs a RETURN
to get back to the main line of execution. In your case, that's probably line 2030.