EVALUATE TRUE 块中的条件是否按照列出的顺序进行评估?
如果我在同一个 EVALUATE TRUE 块中评估自变量,它们是否按照列出的顺序进行评估?
例如,如果天气“寒冷”和“阳光明媚”,我会“带太阳镜吗?”或者我会“穿毛衣”然后退出街区吗?
EVALUATE TRUE
WHEN COLD
WEAR SWEATER
WHEN SUNNY
BRING SUNGLASSES
END-EVALUATE
If I evaluate independent variables in the same EVALUATE TRUE block, are they evaluated in the order they are listed?
E.g., if it's "COLD" and "SUNNY", would I ever "BRING SUNGLASSES?" Or would I just "WEAR SWEATER" and exit the block?
EVALUATE TRUE
WHEN COLD
WEAR SWEATER
WHEN SUNNY
BRING SUNGLASSES
END-EVALUATE
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在许多其他语言中,我们经常需要在每个选择中插入break语句(或类似的语句),这样它就不会失败。然而,COBOL 评估中的情况并非如此,当这些选择之一满足(或不满足)时,COBOL 评估结束。
In many other languages, we often need to insert break statement (or similar) to each selection, so that it does not fall through. However that’s not the case in COBOL evaluate, COBOL evaluate ends when one of those selections satisfies (or none).
是的,它们按照列出的顺序进行评估。一旦满足
WHEN
语句之一的条件,它就会中断代码并转到END-EVALUATE
Yes, they are evaluated in the order they are listed. Once it meets the condition of one of the
WHEN
statements it breaks out of the code and goes to theEND-EVALUATE