Comments: Difference between revisions

From ASCEND
Jump to navigation Jump to search
Created page with "In ASCEND syntax, comments can be written within the special delimiters <tt>(*</tt> and <tt>*)</tt>. Comments can be nested (note that in some text-editors, this can confuse t..."
 
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
In ASCEND syntax, comments can be written within the special delimiters <tt>(*</tt> and <tt>*)</tt>. Comments can be nested (note that in some text-editors, this can confuse the [[syntax highlighting]], but it still works fine in ASCEND)
In ASCEND syntax, comments can be written within the special delimiters <tt>(*</tt> and <tt>*)</tt>.  


Example:
Example:
Line 9: Line 9:
MODEL mymodel;
MODEL mymodel;
     d IS_A distance; (* pipe diameter *)
     d IS_A distance; (* pipe diameter *)
    h IS_A distance; (* change in height *)
END mymodel;
END mymodel;
</source>
</source>
Comments can be '''nested'''. This can be useful, in particular, for temporarily removing parts of the model, e.g. during testing/debugging.
<source lang=a4c>
MODEL mymodel;
    d IS_A distance; (* pipe diameter *)
    (* h IS_A distance; (* change in height *) --we don't need this any more *)
END mymodel;
</source>
Note that in some text-editors, nested comments can confuse the [[syntax highlighting]], but regardless of that, the nested comments will work correctly in the ASCEND parser.
See also
* [[NOTES]], and
* in particular [[NOTES#Inline_notes|inline notes]], which are a better way to label variables because the labels can be collected programmatically and associated with the variable they are labelling.


[[Category:Syntax]]
[[Category:Syntax]]
[[Category:Documentation]]
[[Category:Documentation]]

Latest revision as of 06:31, 12 December 2013

In ASCEND syntax, comments can be written within the special delimiters (* and *).

Example:

(*
    This model is very useless, because it doesn't have
    any equations in it yet.
*)
MODEL mymodel;
    d IS_A distance; (* pipe diameter *)
    h IS_A distance; (* change in height *)
END mymodel;

Comments can be nested. This can be useful, in particular, for temporarily removing parts of the model, e.g. during testing/debugging.

MODEL mymodel;
    d IS_A distance; (* pipe diameter *)
    (* h IS_A distance; (* change in height *) --we don't need this any more *)
END mymodel;

Note that in some text-editors, nested comments can confuse the syntax highlighting, but regardless of that, the nested comments will work correctly in the ASCEND parser.

See also

  • NOTES, and
  • in particular inline notes, which are a better way to label variables because the labels can be collected programmatically and associated with the variable they are labelling.