repetitive routines? bs2
Gumby1108
Posts: 6
Hi all.
I'm doing a project currently that involves alot of repeating phrases which aren't arranged in a way that "do... loop" would be practical (at least as far as I know). I'm using the BS2 which I got from my school, and my program quickly filled up all of the memory. Is there a way that I could consolidate these individual repetitions into a single phrase, which i could then use repetitively in lieu of the weighty original? If there is, could someone in the know give me the most elementary tutorial (preferably in layman's terms - I'm new to this).
Thanks a bundle!
I'm doing a project currently that involves alot of repeating phrases which aren't arranged in a way that "do... loop" would be practical (at least as far as I know). I'm using the BS2 which I got from my school, and my program quickly filled up all of the memory. Is there a way that I could consolidate these individual repetitions into a single phrase, which i could then use repetitively in lieu of the weighty original? If there is, could someone in the know give me the most elementary tutorial (preferably in layman's terms - I'm new to this).
Thanks a bundle!
Comments
Just kidding.
Any sequence of commands can be put into subroutine function and then simply called from other function.
Same as Main; subroutine can have varaiables generally set before the subroutine is called.
Check GOSUB, label and RETURN in Help or manual.
Note function of RETURN and limitation of nesting 4 subroutines.
Example
Test VAR Word
Main:
Test = 10
GOSUB Subroutine_1
GOSUB Subroutine_2
END
Subroutine_1
DEBUG ? Test
Test = 20
GOSUB Subroutine_2
Test = 30
GOSUB Subroutine_2
RETURN
Subroutine_2:
DEBUG ? Test
RETURN
Vaclav