PDA

View Full Version : Subroutince/Function newbie question



LuXo12
09-05-2008, 10:55 AM
Hi everyone I am a n00b so I don't know if that would work or if that is even possible

I am trying to use a subroutine several times in a row and I was wondering if I could do some thing like 3 X GoSub_ONOFF

Here is what i mean:

Instead of writing

GoSub_OnOff
GoSub_OnOff
GoSub_OnOff
GoSub_OnOff
GoSub_OnOff

for x number of times could i do something like?

5 x GoSub_OnOff

and get the same result?

Thanks for help

Mike Green
09-05-2008, 11:05 AM
No

You could write


for i = 1 to 5
gosub GoSub_OnOff
next i


where i is declared as a nib or byte.
Read the PBasic Manual in the chapters on the FOR statement
and the GOSUB statement.

LuXo12
09-05-2008, 10:30 PM
That makes sense, thank you!