September 2017
Beginner
402 pages
9h 52m
English
One-line comments are separated from the program source code with the # character. Everything after the # symbol is skipped by the compiler until the end of the current line.
In the following example, we take the 'Hello, World!' program from Chapter 1, What is Perl 6?, and add a one-line comment to it:
say 'Hello, World!'; # Prints 'Hello, World!'
This is a fully correct Perl 6 program. It has one call of the built-in say function and a comment about what it does. The part of the string, starting from the # character, is a one-line comment.
If you run that program, it prints Hello, World! and nothing more. It works exactly the same as the program with no comments at all.
One-line comments may also occupy a separate line ...
Read now
Unlock full access