diff --git a/doc/langref.html.in b/doc/langref.html.in index 0499c632e2..7fde550338 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -134,6 +134,58 @@ pub fn main() void {
{#see_also|Values|@import|Errors|Root Source File#} {#header_close#} + {#header_open|Comments#} + {#code_begin|test|comments#} +const assert = @import("std").debug.assert; + +test "comments" { + // Comments in Zig start with "//" and end at the next LF byte (end of line). + // The below line is a comment, and won't be executed. + + //assert(false); + + const x = true; // another comment + assert(x); +} + {#code_end#} +
+ There are no multiline comments in Zig (e.g. like /* */
+ comments in C). This helps allow Zig to have the property that each line
+ of code can be tokenized out of context.
+
+ A doc comment is one that begins with exactly three slashes (i.e.
+ /// but not ////);
+ multiple doc comments in a row are merged together to form a multiline
+ doc comment. The doc comment documents whatever immediately follows it.
+
+ Doc comments are only allowed in certain places; eventually, it will + become a compile error have a doc comment in an unexpected place, such as + in the middle of an expression, or just before a non-doc comment. +
+ {#header_close#} + {#header_close#} {#header_open|Values#} {#code_begin|exe|values#} const std = @import("std");