doc/go_spec.html | 2 +- doc/go_tutorial.html | 13 ++++++++++++- doc/go_tutorial.txt | 11 +++++++++++ doc/progs/echo.go | 2 +- diff --git a/doc/go_spec.html b/doc/go_spec.html index bd98c42903d7a35412f5019084d63c42dde001f5..9abebfbe73f30d09a4032d293308cb5447bd1aac 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -2300,7 +2300,7 @@
the result of the index expression is a pair of values with types
-(K, bool).
+(V, bool).
If the key is present in the map,
the expression returns the pair (a[x], true);
otherwise it returns (Z, false) where Z is
diff --git a/doc/go_tutorial.html b/doc/go_tutorial.html
index bbd87bb61c2b2831a26094ba4dacd3f3157bcfc7..201c503bbe27717ccb3209395badf7e2073c83d3 100644
--- a/doc/go_tutorial.html
+++ b/doc/go_tutorial.html
@@ -110,7 +110,7 @@ 22 for i := 0; i < flag.NArg(); i++ {
23 if i > 0 {
24 s += Space
25 }
-26 s += flag.Arg(i)
+26 s += flag.Arg(i);
27 }
28 if !*omitNewline {
29 s += Newline
@@ -134,6 +134,17 @@
Semicolons aren't needed here; in fact, semicolons are unnecessary after any top-level declaration, although they are needed as separators within a parenthesized list of declarations. +
+You can use semicolons just the way you would in C, C++, or Java, but if you
+prefer you can also leave them out in many cases. They separate statements
+rather than terminate them, so they aren't needed (but are still OK) at the end of the last
+statement in a block.
+They're also optional after braces, as in C.
+Have a look at the source to echo.
+The only necessary semicolons in that program are on lines 8, 15, and 21
+and of course between the elements of the for loop on line 22.
+The ones on line 9, 16, 26, and 31 are optional but are there because a semicolon
+on the end of a list of statements makes it easier to edit the list later.
This program imports the "os" package to access its Stdout variable, of type
*os.File. The import statement is actually a declaration: in its general form,
diff --git a/doc/go_tutorial.txt b/doc/go_tutorial.txt
index 8d57dffb6fc0af0d3c20908f1b388bfefa92c16a..b8e18dab8d57456d852547f0a0f1a420e4ef8eab 100644
--- a/doc/go_tutorial.txt
+++ b/doc/go_tutorial.txt
@@ -94,6 +94,17 @@ Semicolons aren't needed here; in fact, semicolons are unnecessary after any
top-level declaration, although they are needed as separators within
a parenthesized list of declarations.
+You can use semicolons just the way you would in C, C++, or Java, but if you
+prefer you can also leave them out in many cases. They separate statements
+rather than terminate them, so they aren't needed (but are still OK) at the end of the last
+statement in a block.
+They're also optional after braces, as in C.
+Have a look at the source to "echo".
+The only necessary semicolons in that program are on lines 8, 15, and 21
+and of course between the elements of the "for" loop on line 22.
+The ones on line 9, 16, 26, and 31 are optional but are there because a semicolon
+on the end of a list of statements makes it easier to edit the list later.
+
This program imports the ""os"" package to access its "Stdout" variable, of type
"*os.File". The "import" statement is actually a declaration: in its general form,
as used in our ``hello world'' program,
diff --git a/doc/progs/echo.go b/doc/progs/echo.go
index 26a2f68b5099a6133238936d42d76af1a22d0894..4761c1e9796c73fccd98b16f7c687be188b7fda4 100644
--- a/doc/progs/echo.go
+++ b/doc/progs/echo.go
@@ -23,7 +23,7 @@ for i := 0; i < flag.NArg(); i++ {
if i > 0 {
s += Space
}
- s += flag.Arg(i)
+ s += flag.Arg(i);
}
if !*omitNewline {
s += Newline