2.1.2 Comments
- Single-line comments begin with a # symbol and extend to the end of the line: - # This is an example of a single-line, standalone comment fun example(n): 1 + n # This single-line comment starts after some code end 
- Block comments begin with a #| symbol and end with a matching |#. - fun example(n): #| This comment can extend over multiple lines |# 1 + n end - While the text of a comment block contains everything between the #| and |# symbols, it is preferred to put them on their own lines, so they are visually distinctive and can easily be added or removed: - #| prefer this style |# - #| instead of this style |# - The one exception is when block comments are being used to comment out sections of a single line of code: - rectangle(30 #|width|#, 40 #|height|#, "solid", "red") - They can be nested within each other, so long as the delimiters are matched: - fun example(n): #| this is in a comment #| so is this and this |# and this |# 1 + n end Within a block comment, single-line comments are ignored:- fun example(n): #| This is a block comment. Even though the next line starts a single-line comment # the block-comment ends here |# 1 + n end - (Naturally, this style isn’t preferred, as it is easy to ignore the end-of-comment marker when reading quickly!)