PLC编程中为什么是Elsif而不是Else If
我是一名 PLC 程序员,我想知道为什么使用保留字 elsif (即没有 E )。我知道 elseif 或任何其他组合不用作保留字。是否有在其他语言中使用它的历史?如果是这样为什么?只是为了节省打字时间,因为对我来说,我似乎每天都会犯下 5 次 e 的错误。
Im a PLC programmer and I am wondering why the reserved word elsif (ie without the E ) is used. I know that elseif or any other combination is not used as reserved words. Is there a history to use this in other Languages. If so why? just to save on typing cause for me I seem to make the mistake of typing the e probably 5 times a day.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
编程语言在这一点上从未达成一致。各种通用语言使用:
也许还有其他语言。语言设计者通常没有充分的理由选择其中一种。
(如果您能说出一些使用上述每种形式的语言,即可加分!)
Programming languages have never quite agreed on this. Various common languages use:
and perhaps others. There's often no good reason for the language designer choosing one over another.
(Bonus points if you can name some languages that use each of the above forms!)
我想知道你正在编程什么类型的 PLC,我刚刚发现罗克韦尔结构化文本使用 elsif,Ada 也使用了,但这并不是真正适合 PLC 的,不是吗?
有人告诉我这是语法糖,elsif 就在那里,所以你的代码不会被大量括号弄乱
。
就起源而言,我猜测它自 Ada 或之前的任何东西以来就一直存在。
I wonder what type of PLC you are programming, I just found out rockwells structured text uses elsif, and Ada did but thats not really for PLCs is it?
I am told it's Syntactic sugar, the elsif is there so you don't have your code cluttered up by lots of brackets
becomes
As far as the origin goes my guess would be it has just stuck around since Ada or whatever was before that.
Pascal 是 PLC 中使用的结构化文本(西门子称之为 SCL)之父。
Pascal is the father of Structured Text (or SCL as called by Siemens) used in PLCs.