If statement COBOL if else if语句,正确使用它们的方法
我是COBOL新手,想写一个嵌套的if语句。我在ELSE-IF和ELSE上出错了。我相信这是一个简单的解决办法,但我不知道我哪里出了问题If statement COBOL if else if语句,正确使用它们的方法,if-statement,cobol,If Statement,Cobol,我是COBOL新手,想写一个嵌套的if语句。我在ELSE-IF和ELSE上出错了。我相信这是一个简单的解决办法,但我不知道我哪里出了问题 reading-procedure. display "Enter Type of Pet: " with no advancing. accept pet. display "Enter Appointment Fee: " with no advancing. accept fee. I
reading-procedure.
display "Enter Type of Pet: " with no advancing.
accept pet.
display "Enter Appointment Fee: " with no advancing.
accept fee.
IF pet = 'dog'
add fee total giving dogTotal.
add 1 to dogCount.
ELSE-IF pet = 'cat'
add fee total giving catTotal.
add 1 to catCount.
ELSE
add fee total giving otherTotal.
add 1 to otherCount.
END-IF
COBOL中没有(标准)else if
语句。
在大多数情况下,当条件-1和条件-2[…]结束时,您有多个分支使用评估真值
,结束时评估
是您想要使用的-在类似示例的情况下,您可以在“狗”时对宠物进行评估。。。当“猫”。。。最终评估
ELSE
出现语法错误的原因很简单:你用句号结束它们-去掉它们(你在程序部分中唯一需要它们的部分是段落/章节/条目定义前后。你找到了“适合你”的答案吗?如果是,请接受(目前是)“打开”),否则我建议对答案进行评论。