Comments are sections of code which are ignored by the interpreter. You may use them to write notes describing your code or to aid people reading your code in understanding it.
Cheddar has C-style comments, you can delimit a comment either with //
or /* .. */
:
Comments can go wherever whitespace can go. This means comments do not work within strings.
A single-line comment //
, starts at any point in the line and continues until either a new line or the EOF (end of file).
// Hello, World! This is my comment
Multiline comments are a little more special. They support nested comments which will elaborated more on. They will span until a matching */
has been found or the EOF.
/*Hello, this is my multi-line comment.I can use this to quickly mark out blocks of codeor to just write longer messages.*/
/*This comment does not have an ending,but it will work.This is because comments will continue tothe EOF if it can't find a `/*`
/*This is an example of nested comments.If there is another multiline commentwithin this one. It won't close this comment/*This is another coment*/This comment is still going as the previous `*/`did not close this comment.Note: the `*/` before has a zero-width spacebetween the * and /.This is why the comment didn't end*/
Nested block comments may not work at the moment. If you encounter any problems, please report the given source code on github and it'll (hopefully) be fixed promptly.