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 -->
<!-- subtitle Version of March 3, 2011 -->
<!-- subtitle Version of March 7, 2011 -->
<!--
TODO
......@@ -4212,7 +4212,7 @@ func complex_f2() (re float64, im float64) {
</pre>
</li>
<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
and the function may assign values to them as necessary.
The "return" statement returns the values of these variables.
......@@ -4222,6 +4222,11 @@ func complex_f3() (re float64, im float64) {
im = 4.0
return
}
func (devnull) Write(p []byte) (n int, _ os.Error) {
n = len(p)
return
}
</pre>
</li>
</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