PDA

View Full Version : subroutine question



maus
- 10th September 2006, 20:58
i want to create a selection that automaticly goes into the right sub menu

for example is counter=1 then gosub routine1, counter=2 then gosub routine2, counter=3 then gosub routine3 etc.

something like this:

main routine:

counter=counter+1
'do whatever i wanna do

gosub routine(counter)

'and on
goto main

routine1:
'do 1st:return

routine2:
'do 2nd:return

routine3:
'do 3th:return

can this be done simple in picbasic, so i can keep my main program short !

thanx allready for your ideas and suggestions

mister_e
- 10th September 2006, 22:57
use BRANCH or BRANCHL. But don't forget, it's multiple goto, not gosub.

OR use SelectCase



Select Case Counter
Case 1 : Gosub Routine1
Case 2 : Gosub Routine2
Case 3 : Gosub Routine3
'
'
End Select

maus
- 11th September 2006, 21:36
thanx for helping my on the way again,

i tested with BRANCH and it works