From f0d36c0eed6da33db609baf35032531dd901806e Mon Sep 17 00:00:00 2001 From: hegdeashwin Date: Sat, 14 Mar 2015 13:10:07 +0530 Subject: [PATCH] Adds types egs --- ch1/booleans.go | 13 +++++++++++++ ch1/main.go | 7 +++++++ ch1/numbers.go | 8 ++++++++ ch1/strings.go | 17 +++++++++++++++++ 4 files changed, 45 insertions(+) create mode 100644 ch1/booleans.go create mode 100644 ch1/main.go create mode 100644 ch1/numbers.go create mode 100644 ch1/strings.go diff --git a/ch1/booleans.go b/ch1/booleans.go new file mode 100644 index 0000000..4379071 --- /dev/null +++ b/ch1/booleans.go @@ -0,0 +1,13 @@ +package main + +import "fmt" + +func main() { + fmt.Println(true && true) + fmt.Println(true && false) + fmt.Println(true || true) + fmt.Println(true || false) + fmt.Println(!true) + + fmt.Println((true && false) || (false && true) || !(false && false)) +} diff --git a/ch1/main.go b/ch1/main.go new file mode 100644 index 0000000..91e7378 --- /dev/null +++ b/ch1/main.go @@ -0,0 +1,7 @@ +package main + +import "fmt" + +func main() { + fmt.Println("Hello World") +} diff --git a/ch1/numbers.go b/ch1/numbers.go new file mode 100644 index 0000000..72c9988 --- /dev/null +++ b/ch1/numbers.go @@ -0,0 +1,8 @@ +package main + +import "fmt" + +func main() { + fmt.Println("1 + 1 = ", 1 + 1) + fmt.Println("1.0 + 1.0 = ", 1.0 + 1.0) +} diff --git a/ch1/strings.go b/ch1/strings.go new file mode 100644 index 0000000..11f1704 --- /dev/null +++ b/ch1/strings.go @@ -0,0 +1,17 @@ +package main + +import "fmt" + +func main() { + fmt.Println(len("Ashwin Hegde")) + fmt.Println("Ashwin Hegde"[1]) + fmt.Println("Ashwin " + "Hegde") + +// fmt.Println("Ashwin" + 45) +// fmt.Println("45" + 45) + +// fmt.Println(5 + 5 + 5) +// fmt.Println("5" + 5 + 5) +// fmt.Println(5 + "5" + 5) +// fmt.Println(5 + 5 + "5") +}