aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2011-02-22 15:31:57 -0800
committerRobert Griesemer <gri@golang.org>2011-02-22 15:31:57 -0800
commita1368a6ad0f413c57b2487806c7058146b21678b (patch)
treebe187d019636c9e12582509753ffe881062a2a79
parent52943bfe4d1a85e64e35a5c1173ce04ae2b98bb6 (diff)
downloadgo-a1368a6ad0f413c57b2487806c7058146b21678b.tar.gz
go-a1368a6ad0f413c57b2487806c7058146b21678b.zip
go spec: make condition mandatory in if statements
Plus a few minor HTML fixes. Fixes #1535. R=r, rsc, ken2, iant, r2 CC=golang-dev https://golang.org/cl/4185065
-rw-r--r--doc/go_spec.html15
1 files changed, 7 insertions, 8 deletions
diff --git a/doc/go_spec.html b/doc/go_spec.html
index 54fa50421e..25eb3c4644 100644
--- a/doc/go_spec.html
+++ b/doc/go_spec.html
@@ -2744,7 +2744,7 @@ and finally <code>||</code> (logical or):
Precedence Operator
5 * / % &lt;&lt; &gt;&gt; &amp; &amp;^
4 + - | ^
- 3 == != &lt; &lt;= > >=
+ 3 == != &lt; &lt;= &gt; &gt;=
2 &amp;&amp;
1 ||
</pre>
@@ -2760,7 +2760,7 @@ For instance, <code>x / y * z</code> is the same as <code>(x / y) * z</code>.
x &lt;= f()
^a &gt;&gt; b
f() || g()
-x == y+1 &amp;&amp; &lt;-chan_ptr > 0
+x == y+1 &amp;&amp; &lt;-chan_ptr &gt; 0
</pre>
@@ -3686,17 +3686,16 @@ complex, or string constant.
"If" statements specify the conditional execution of two branches
according to the value of a boolean expression. If the expression
evaluates to true, the "if" branch is executed, otherwise, if
-present, the "else" branch is executed. A missing condition
-is equivalent to <code>true</code>.
+present, the "else" branch is executed.
</p>
<pre class="ebnf">
-IfStmt = "if" [ SimpleStmt ";" ] [ Expression ] Block [ "else" Statement ] .
+IfStmt = "if" [ SimpleStmt ";" ] Expression Block [ "else" Statement ] .
</pre>
<pre>
-if x > 0 {
- return true;
+if x &gt; max {
+ x = max
}
</pre>
@@ -3708,7 +3707,7 @@ executes before the expression is evaluated.
<pre>
if x := f(); x &lt; y {
return x
-} else if x > z {
+} else if x &gt; z {
return z
} else {
return y