PDA

View Full Version : Program flow control: this is so lame



Gerry Shand
02-23-2010, 12:33 PM
First of all I am going to apologize for this post but I am having issues trying to do program flow control using "If ... Then" statements and could not find anything in the archives. But I am tired so the answer is probably pretty obvious to the group here and another set of eyes always helps.

Here goes:

In trying to do program flow control, this is a chunk of what I have been doing:

Relay1:
If x=1 then Relay2
goto Relay3

Relay2:
Do task A
If y=6 then Relay 4

Relay3:
Do task B

Relay4:
Do task C

Goto Relay1

This works but the big question is: Can this be done more elegantly so I use less space in the BS-2? I have tried using IF THEN ELSE without any luck. Maybe something with a Branch command?

Any thoughts would be appreciated and thanks in advance for any pointers.

Gerry, the tired

PJ Allen
02-23-2010, 12:49 PM
I can getĚrid of a GOTO:

Relay1:
If x=1 then Relay2
goto Relay3
IF x <> 1 THEN Relay3


Relay2:
"do task A"
IF y = 6 THEN Relay4

Relay3:
"do task B"

Relay4:
"do task C"
GOTO Relay1