0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Gnu-COBOL EVALUATEで条件分岐

Last updated at Posted at 2020-09-03
  • EVALUATE 条件...END-EVALUATE.
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO.

DATA DIVISION.
  WORKING-STORAGE SECTION.
    01 SIGNAL PIC X(5).
PROCEDURE DIVISION.
  MAIN SECTION.
  MOVE "YELLOW" TO SIGNAL.

  EVALUATE SIGNAL             *> 「EVALUATE」
    WHEN "RED"                *> 処理部分は「.」不要
      DISPLAY "STOP!"
    WHEN "BLUE"
    WHEN "GREEN"
      DISPLAY "GO!"
    WHEN "YELLOW"
      DISPLAY "CAUTION!"
    WHEN OTHER                *> 「OTHRE」 どの「WHEN」にも当てはまらない場合
      DISPLAY "WRONG SIGNAL!"
    END-EVALUATE.             *> 「END-EVALUATE.」
  STOP RUN.

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?