Commit 638c70d4 authored by Luke  Thorpe's avatar Luke Thorpe
Browse files

Added answer to 'Gap 12'

parent 72ce4ac4
No preview for this file type
......@@ -632,11 +632,13 @@ Any other type of occurrence of whitespace is ignored by the compiler.
Note, in particular, that the code indentation in the example programs has no meaning, it simply aids readability.
Also note that whitespace inside a string or character literal is preserved by the compiler.
\hl{Comments are denote by the} \lit*{\lit{\hl{\#}}} \hl{character which must be on the same line.
A comment must be preceded by the hashtag. For example,} \lit*{\lit{\hl{\#this is a comment}}} \hl{is a valid comment, but}
\\*\lit*{\lit{\hl{this is treated as program statement \#comment}}} \hl{will throw a syntax error, with only `comment'
evaluated as a comment. Comments can be written above or below program statements, in-line, or after the} \lit*{\hl{;}}
\hl{character as well.}
\hl{The hashtag symbol, }\lit{\hl{\#}}\hl{, denotes the start of a comment, which can be written above or below program statements, in-line, or even after the }\lit{\hl{;}} \hl{ character.}
\hl{For example: }\lit{\hl{\#this is a comment}}\hl{, is valid, but notably, so is this: }\lit{\hl{int x = 42 \#the meaning of life}}.
\hl{Intuitively, the compiler simply ignores text between a singleton}\footnotemark[2] \lit{\hl{\#}}\hl{ and a newline character. As such, comments can span multiple lines, so long as each new line starts with a }\lit{\hl{\#}.}
\footnotetext[2]{The \lit{\#} symbol can be used as a \lit{char} value, for example, by surrounding it by quotation marks; it need not be treated as a special character..}
\fillgap{\hl{Define/describe comments}}{3 marks}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment