Commit fb64e0d9 authored by Robert Griesemer's avatar Robert Griesemer

go spec: clarify return statement rules

Added example of a return statement w/o expressions
in a function with a _ result parameter.

See also: http://code.google.com/p/go/issues/detail?id=1586

R=rsc, r, iant
CC=golang-dev
https://golang.org/cl/4266049
parent 800217f8
<!-- title The Go Programming Language Specification --> <!-- title The Go Programming Language Specification -->
<!-- subtitle Version of March 3, 2011 --> <!-- subtitle Version of March 7, 2011 -->
<!-- <!--
TODO TODO
...@@ -4212,7 +4212,7 @@ func complex_f2() (re float64, im float64) { ...@@ -4212,7 +4212,7 @@ func complex_f2() (re float64, im float64) {
</pre> </pre>
</li> </li>
<li>The expression list may be empty if the function's result <li>The expression list may be empty if the function's result
type specifies names for its result parameters (§<a href="#Function_Types">Function Types</a>). type specifies names for its result parameters (§<a href="#Function_types">Function Types</a>).
The result parameters act as ordinary local variables The result parameters act as ordinary local variables
and the function may assign values to them as necessary. and the function may assign values to them as necessary.
The "return" statement returns the values of these variables. The "return" statement returns the values of these variables.
...@@ -4222,6 +4222,11 @@ func complex_f3() (re float64, im float64) { ...@@ -4222,6 +4222,11 @@ func complex_f3() (re float64, im float64) {
im = 4.0 im = 4.0
return return
} }
func (devnull) Write(p []byte) (n int, _ os.Error) {
n = len(p)
return
}
</pre> </pre>
</li> </li>
</ol> </ol>
......
Markdown is supported
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