Multiple Statements within one IF stmt

I know it’s bad form to use a GOTO or GOSUB command. They are to avoided at all cost but… I need some syntax or examples of putting multiple statements/commands between the THEN and the ELSE. I could eliminate all my GOSUB or GOTO commands if I knew how to do something like the following example. Other languages let you do something like:
100 IF this is true and this is true or that is true THEN
110 do this veeeeeerrrrrrryyyyyy long statement
120 do this too
130 do this also it might be a nested IF
140 REMcan’t put lines 110~130 on 1 line w/comma delimiters cuz theyd be too long
140 ELSE do this
150 ENDIF

I will just continue using a GOSUB at the end of line 100 and put lines 110~ 140 in it if that’s my only option. My goal is just to program as efficiently as possible. Any examples would be welcome. Maybe I am just ignorant on how to make program lines longer than 80 characters.

2 Likes

I’d like to know also.

1 Like

I would use a local variable.

10 IF this and that then A= 1 else A = 0
20 IF A = 1 THEN DO THIS
30 IF A = 1 THEN DO THIS TOO

A is only used in this particular program, it doesn’t take up space in the usual VARS table and you cannot see it outside the program. If you did want to see it outside the program and put it on displays and trend logs then you could use one of the VARS instead.

Brilliant. I will absolutely try this. Maurice, I think you are starting to realize your dream of having the Temco forum become a great support resource! Do you think I could create a local variable called IFCONT or MOREIF ?

Ted

Ted

Yes, give it any name you like but of course steer away from the key words. The local variables will be grey in color, after you send and then reload the program though.

image