Why Elsif Is Not Else If PLC Programming

I am a PLC programmer, and I wonder why the reserved word elsif is used (i.e. without E). I know that elseif or any other combination is not used as reserved words. Is there a story to use this in other languages. If so, why? just to save on typing for me, I seem to be mistaken typing e, probably 5 times a day.

+7
source share
3 answers

Programming languages โ€‹โ€‹never agreed to this. Various common languages โ€‹โ€‹use:

else if elseif elsif elif 

and possibly others. Often there is no good reason for a language designer to choose one after another.

(Bonus points if you can name some languages โ€‹โ€‹that use each of the above forms!)

+6
source

I wonder what type of PLC you are programming, I just found that Rockwells structured text uses elsif, and Ada did, but it isnโ€™t for the PLC, is it?

They tell me that this is syntactic sugar, there is elsif, so you do not have code cluttered with many brackets.

 if cond1 then funct1 elsif cond2 then funct2 elsif cond3 then funct3 else funct4 end if 

becomes

 if cond1 then funct1 else (if cond2 then funct2 else (if cond3 then funct3 else funct4 )) end if 

As for the origin, I guess he was just stuck with Ada or something else before that.

0
source

Pascal is the father of structured text (or SCL, which is called Siemens), which is used in the PLC.

0
source

All Articles