Menu
CoddyTech

Comments

Part of the First Programs section of Coddy's COBOL Programming journey. Lesson 3 of 19.

A comment is text the compiler skips. In COBOL, *> starts a comment: the rest of the line is ignored.

*> Greet the user
DISPLAY "Hi". *> one line

Programs use comments to explain why a line is there. A *> in front of a statement turns it off without deleting it:

*> DISPLAY "Not shown".
DISPLAY "Shown".
challenge icon

Challenge

Easy

The program prints two lines. Turn the second DISPLAY into a comment, so it prints only Good morning!

Try it yourself

       IDENTIFICATION DIVISION.
       PROGRAM-ID. GREET.
       PROCEDURE DIVISION.
           DISPLAY "Good morning!".
           DISPLAY "Good night!".
           STOP RUN.

All lessons in First Programs