summaryrefslogtreecommitdiff
path: root/doc/progs/print.go
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2009-01-09 15:16:31 -0800
committerRob Pike <r@golang.org>2009-01-09 15:16:31 -0800
commitbc23ce679061b8f41f551578181b9feeb24f5c0a (patch)
tree64f4931996e82c6dff92d3c7647814b7c43469b3 /doc/progs/print.go
parent0509e08028f63b53b65f294e06d603ccfdb76c22 (diff)
downloadgolang-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/print.go')
-rw-r--r--doc/progs/print.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/doc/progs/print.go b/doc/progs/print.go
new file mode 100644
index 000000000..ed3f4e269
--- /dev/null
+++ b/doc/progs/print.go
@@ -0,0 +1,20 @@
+// Copyright 2009 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import "fmt"
+
+func main() {
+ var u64 uint64 = 1<<64-1;
+ fmt.printf("%d %d\n", u64, int64(u64));
+
+ // harder stuff
+ type T struct { a int; b string };
+ t := T{77, "Sunset Strip"};
+ a := []int{1, 2, 3, 4};
+ fmt.printf("%v %v %v\n", u64, t, a);
+ fmt.print(u64, " ", t, " ", a, "\n");
+ fmt.println(u64, t, a);
+}