On this page:
Comment Lines, Comments in Scripts, In-Command Comments, Overview.
This page makes references to loops, which will be discussed in the next chapter.
Comments can have two purposes: documentation, or information for a script's user.
A comment line, that is a line that begins with the hash sign #, can be included in script files and in insert files (which usually will be data files).
In an insert file, comment lines will always be ignored by Hypatia -- you will only see them when you open the file with an editor.
In a script file, a comment line will be displayed when the script is called directly, but not when it is called in a loop (unless echo mode is on).
A comment line that begins with double hash signs ## will never be displayed, except with echo mode on.
For documentation purposes in scripts you can add a comment at the end of any command or calculation line, preceded by a space and double hash signs ##. These comments will never be displayed, not even in echo mode.
Comment lines get displayed with upper and lower case characters as they were written.
In loops, comments (that is, text beginning with the hash sign #) following I1:, I*:, THEN, ALSO: and ELSE: are treated as commands, they will be displayed when those conditions are met.
The commands SAVE, SAVE@ and BUFFER SAVE let you add an optional comment after the file name.
Anything after the file name is a comment, it does not need to begin with a hash sign.
This comment will be written as a comment line at the beginning of the file.
The files written by SAVE and SAVE@ are script files. Therefore, when you retain the variables or user defined elements saved to these files with _filename, the comment line will be displayed.
A file written by BUFFER SAVE consists of numbers and can only be used as an insert file, the comment line will not be displayed by Hypatia.
The PROMPT command lets you add an optional comment after the name of the variable.
As with the SAVE commands this comment does not need to begin with a hash sign.
The PROMPT comment will be displayed when the PROMPT command is executed, to inform the user about the value they are asked to enter.
For technical reasons, these in-command comments will be all in lower case regardless of how you type them, with the first character in upper case.
# comment -- comment line, starts with a hash sign, will be shown in a script but not when the script runs in a loop.
IF ... THEN # comment -- comment following I1:, I*:, IF ... THEN, ALSO: or ELSE: will always be shown when the condition is met.
#: comment -- comment line, starts with hash sign and colon, will always be shown.
## comment -- comment line, starts with double hash signs, will never be shown (except with echo mode on).
... ## comment -- comment can be added to a command or calculation line after space and double hash signs, will never be shown.
Commands that accept optional comments, no hash sign needed:
POMPT $variable comment -- comment will be shown.
SAVE filename comment -- comment will be written to file as comment line.
SAVE@ filename comment -- comment will be written to file as comment line.
BUFFER SAVE filename comment -- comment will be written to file as comment line.
Comment lines in insert files are never shown.
Home, Up: Scripts, Prev: IF ... THEN Conditions, Next: Script Example: Body Mass Index