EVALUATE TRUE 块中的条件是否按照列出的顺序进行评估?

发布于 2024-12-17 08:14:05 字数 228 浏览 3 评论 0原文

如果我在同一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

三人与歌 2024-12-24 08:14:05

在许多其他语言中,我们经常需要在每个选择中插入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).

宛菡 2024-12-24 08:14:05

是的,它们按照列出的顺序进行评估。一旦满足 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 the END-EVALUATE

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文