diff options
author | Rob Pike <r@golang.org> | 2009-01-09 15:16:31 -0800 |
---|---|---|
committer | Rob Pike <r@golang.org> | 2009-01-09 15:16:31 -0800 |
commit | bc23ce679061b8f41f551578181b9feeb24f5c0a (patch) | |
tree | 64f4931996e82c6dff92d3c7647814b7c43469b3 /doc/progs/sum.go | |
parent | 0509e08028f63b53b65f294e06d603ccfdb76c22 (diff) | |
download | golang-bc23ce679061b8f41f551578181b9feeb24f5c0a.tar.gz |
update tutorial to new language.
add a section on printing
add a section on allocation
R=rsc
DELTA=500 (278 added, 15 deleted, 207 changed)
OCL=22381
CL=22456
Diffstat (limited to 'doc/progs/sum.go')
-rw-r--r-- | doc/progs/sum.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/doc/progs/sum.go b/doc/progs/sum.go index c8e7b10a7..3ca1a5877 100644 --- a/doc/progs/sum.go +++ b/doc/progs/sum.go @@ -4,7 +4,7 @@ package main -func sum(a *[]int) int { // returns an int +func sum(a []int) int { // returns an int s := 0; for i := 0; i < len(a); i++ { s += a[i] @@ -14,6 +14,6 @@ func sum(a *[]int) int { // returns an int func main() { - s := sum(&[]int{1,2,3}); // pass address of int array + s := sum([3]int{1,2,3}); // a slice of the array is passed to sum print(s, "\n"); } |