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 the user of a script.
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 if 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 #) after I1:, I*:, THEN, ALSO: and ELSE: will be 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 contains numbers and can only be used as an insert file, the comment line will not be displayed by Hypatia.
A comment can also follow the name of the variable in a PROMPT command.
As with SAVE etc. 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 requested to enter.
For technical reasons, these in-command comments will be all in lower case regardless of how you type them, but the first character will be upper case.
# comment -- comment line, starts with a hash sign, will be shown in a script but not in a loop.
Comments following I1:, I*:, IF ... THEN, ALSO: or ELSE: will be shown in a loop when the condition is met.
#: comment -- comment line, starts with hash sign and colon, will be shown in a loop.
## comment -- comment line, starts with double hash signs, will not be shown.
... ## comment -- comment can be added to a command or calculation line after space and double hash signs, will not 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