| 
   Home Manual Packages Global Index Keywords Quick Reference
   | 
  1.3.2.2 Comments 
There are two ways to insert comments into a Yorick program.  These
are the C style /* ... */ and the C++ style //:
 
 |  | // C++ style comments begin with // (anywhere on a line)
// and end at the end of that line.
E = m*c^2;  /* C style comments begin with slash-star, and
               do not end until start-slash, even if that
               is several lines later.  */
/* C style comments need not annotate a single line.
 * You should pick a comment style which makes your
 * code attractive and easy to read.  */
F = m*a;         // Here is another C++ style comment...
divE = 4*pi*rho; /* ... and a final C style comment. */
 | 
 
I strongly recommend C++ style comments when you "comment
out" a sequence of Yorick statements.  C style comments do not nest
properly, so you can't comment out a series of lines which contain
comments:
 
 |  | /*
E = m*c^2;   /* ERROR -- this ends the outer comment --> */
F = m*a
*/ <-- then this causes a syntax error
 | 
 
The C++ style not only works correctly; it also makes it more obvious
that the lines in question are comments:
 
 |  | // E = m*c^2;   /* Any kind of comment could go here.  */
// F = m*a;
 | 
 
Yorick recognizes one special comment: If the first line of an include
file begins with #!, Yorick ignores that line.  This allows Yorick
include scripts to be executable on UNIX systems supporting the "pound
bang" convention:
 
 |  | #!/usr/local/bin/yorick -batch
/* If this file has execute permission, UNIX will use Yorick to
 * execute it.  The Yorick function get_argv can be used to accept
 * command line arguments (see help, get_argv).  You might want
 * to use -i instead of -batch on the first line.  Read the help
 * on process_argv and batch for more information.  */
write, "The square root of pi is", sqrt(pi);
quit;
 | 
 
 
 |