From c179a25a6a9df9010e12abfa9d6a75441776a1bb Mon Sep 17 00:00:00 2001 From: Mark McGranaghan Date: Thu, 20 Sep 2012 19:17:39 -0700 Subject: [PATCH] trim up --- src/02-values.go | 15 +++++++++++---- src/44-string-fns.go | 1 + 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/02-values.go b/src/02-values.go index 9fe59ce..4955f6e 100644 --- a/src/02-values.go +++ b/src/02-values.go @@ -7,8 +7,7 @@ import "fmt" func main() { fmt.Println("Hello world") // Strings - you already saw these. - fmt.Println("Hello World"[1]) - fmt.Println("Hello " + "World") + fmt.Println("Hello " + "other") fmt.Println("1+1 =", 1+1) // Integers and floats. fmt.Println("7.0/3.0 =", 7.0/3.0) @@ -18,5 +17,13 @@ func main() { fmt.Println(!true) } - // This is just a sampling of Go's value types. We'll - // learn more about them as we go. +/* +$ go run 02-values.go +Hello world +Hello other +1+1 = 2 +7.0/3.0 = 2.3333333333333335 +false +true +false +*/ diff --git a/src/44-string-fns.go b/src/44-string-fns.go index e9fef2c..f9078b1 100644 --- a/src/44-string-fns.go +++ b/src/44-string-fns.go @@ -7,6 +7,7 @@ func p(o interface{}) { } func main() { + p("hello"[0]) p(strings.Contains("test", "es")) p(strings.Count("test", "t")) p(strings.HasPrefix("test", "te"))