Rexx Programming/How to Rexx/comment

Comments are helpful side notes within the code. They are meant for humans, not for computers. They have to be notated a certain way so that the computer will ignore them. In Rexx, a comment begins with a forward slash, followed by an asterisk (/*) and then with whatever you want to say. A comment ends with the same two characters in reverse order: a an asterisk, followed by a forward slash (*/).

/* This is a comment: the computer doesn't care what it says. */

If you think a section of code needs to be explained to the reader, you can write a comment nearby to summarize it or to point out important features. Historically, some Rexx interpreters have required every program to begin with a comment. You're likely to see many comments in example Rexx programs to explain what the Rexx code means for people who don't already know the language.

/* Here's a program that adds 3 and 5. */ sum = 3 + 5 /* It can show us the sum when it's finished. */ say sum /* Notice how the comments restate the program in human language. */

Since a slash-star comment must always end with a star-slash, it can be as long as want. Newlines will be ignored just like everything else inside the comment. Make sure to always close your comment when you've finished your message, so that you don't accidentally cause the interpreter to ignore a large, important part of your script.

/*   This is a multiline comment. The interpreter will ignore everything! It will just keep ignoring the text until we finally bring the comment to a close. */

Most programming languages have some way to include comments within the code. In fact, many programming languages use the same slash-star notation for comments that Rexx does. If you've programmed before, you might recognize this notation from C, C++, C#, Go, Java, JavaScript, Rust, or some other language. Those languages also have a second kind of comment that Rexx doesn't have: a comment that starts with two slashes and ends with a newline. A double-slash has a different meaning in Rexx, so be careful not to use it for comments.

// This is not a comment. It would be a programming error.