]> Cypherpunks repositories - gostls13.git/commitdiff
spec: clarify default "true" condition/tag in for/switch statements
authorRobert Griesemer <gri@golang.org>
Tue, 25 Feb 2014 17:13:37 +0000 (09:13 -0800)
committerRobert Griesemer <gri@golang.org>
Tue, 25 Feb 2014 17:13:37 +0000 (09:13 -0800)
An absent condition/tag in for and switch statements is equivalent
to the predeclared constant true; not simply the expression true
(which might lead to a locally defined true).

Not a language change.

Fixes #7404.

LGTM=iant, r
R=r, iant, rsc, ken
CC=golang-codereviews
https://golang.org/cl/68150046

doc/go_spec.html

index 3b6769d7400b4c9dcc32f8cec25f16f3ebef876e..6bde7ab6fcf4420b7a043a1ef9ed49e781c874cd 100644 (file)
@@ -1,6 +1,6 @@
 <!--{
        "Title": "The Go Programming Language Specification",
-       "Subtitle": "Version of Jan 14, 2014",
+       "Subtitle": "Version of Feb 25, 2014",
        "Path": "/ref/spec"
 }-->
 
@@ -4459,8 +4459,8 @@ If no case matches and there is a "default" case,
 its statements are executed.
 There can be at most one default case and it may appear anywhere in the
 "switch" statement.
-A missing switch expression is equivalent to
-the expression <code>true</code>.
+A missing switch expression is equivalent to the boolean value
+<code>true</code>.
 </p>
 
 <pre class="ebnf">
@@ -4625,7 +4625,8 @@ Condition = Expression .
 In its simplest form, a "for" statement specifies the repeated execution of
 a block as long as a boolean condition evaluates to true.
 The condition is evaluated before each iteration.
-If the condition is absent, it is equivalent to <code>true</code>.
+If the condition is absent, it is equivalent to the boolean value
+<code>true</code>.
 </p>
 
 <pre>
@@ -4662,7 +4663,8 @@ only if the block was executed).
 Any element of the ForClause may be empty but the
 <a href="#Semicolons">semicolons</a> are
 required unless there is only a condition.
-If the condition is absent, it is equivalent to <code>true</code>.
+If the condition is absent, it is equivalent to the boolean value
+<code>true</code>.
 </p>
 
 <pre>