f799a4598f9a11a084fa9b81be2701240241942a — coltonhurst 11 months ago 20b7c97
Added 1.1.13 and gofmt'd the package
M basics/packages-variables-functions/1.1.10_short-variable-declaration.go => basics/packages-variables-functions/1.1.10_short-variable-declaration.go +1 -1
@@ 17,4 17,4 @@ func main() {
 	c, python, java := true, false, "no!"
 
 	fmt.Println(i, j, k, c, python, java)
-}>
\ No newline at end of file
+}

M basics/packages-variables-functions/1.1.11_basic-types.go => basics/packages-variables-functions/1.1.11_basic-types.go +4 -4
@@ 23,13 23,13 @@ import (
 
 // variable declarations can be "factored" into blocks like import statements
 var (
-	ToBe bool = false
-	MaxInt uint64 = 1<<64 - 1
-	z complex128 = cmplx.Sqrt(-5 + 12i)
+	ToBe   bool       = false
+	MaxInt uint64     = 1<<64 - 1
+	z      complex128 = cmplx.Sqrt(-5 + 12i)
 )
 
 func main() {
 	fmt.Printf("Type %T Value: %v\n", ToBe, ToBe)
 	fmt.Printf("Type %T Value: %v\n", MaxInt, MaxInt)
 	fmt.Printf("Type %T Value: %v\n", z, z)
-}>
\ No newline at end of file
+}

M basics/packages-variables-functions/1.1.12_zero-values.go => basics/packages-variables-functions/1.1.12_zero-values.go +1 -1
@@ 25,4 25,4 @@ func main() {
 	var b bool
 	var s string
 	fmt.Printf("%v %v %v %q\n", i, f, b, s)
-}>
\ No newline at end of file
+}

A basics/packages-variables-functions/1.1.13_type-conversions.go => basics/packages-variables-functions/1.1.13_type-conversions.go +25 -0
@@ 0,0 1,25 @@
+/*
+	Notes 1.1.13
+
+	- In Go, assignments of different types requires explicit
+	  conversion, unlike C
+	- To do a type conversion, use T(v) where it converts the value v
+	  to type T
+*/
+
+package main
+
+import (
+	"fmt"
+	"math"
+)
+
+// given sides of length 3 and 4 of a triangle, we will
+// compute the hypotenuse sqrt(a^2 + b^2) because:
+// c^2 = a^2 + b^2
+func main() {
+	var x, y int = 3, 4
+	var f float64 = math.Sqrt(float64(x*x + y*y))
+	var z uint = uint(f)
+	fmt.Println(x, y, z)
+}

M basics/packages-variables-functions/1.1.1_packages.go => basics/packages-variables-functions/1.1.1_packages.go +1 -1
@@ 15,4 15,4 @@ import (
 
 func main() {
 	fmt.Println("My favorite number is ", rand.Intn(10))
-}>
\ No newline at end of file
+}

M basics/packages-variables-functions/1.1.2_imports.go => basics/packages-variables-functions/1.1.2_imports.go +2 -2
@@ 8,11 8,11 @@
 
 package main
 
-import(			// this import is known as the 'factored import statement'
+import ( // this import is known as the 'factored import statement'
 	"fmt"
 	"math"
 )
 
 func main() {
 	fmt.Printf("Now you have %g problems.\n", math.Sqrt(7))
-}>
\ No newline at end of file
+}

M basics/packages-variables-functions/1.1.3_exported-names.go => basics/packages-variables-functions/1.1.3_exported-names.go +3 -3
@@ 7,11 7,11 @@
 
 package main
 
-import(
+import (
 	"fmt"
 	"math"
 )
 
 func main() {
-	fmt.Println(math.Pi)	// notice the capital 'P'
-}>
\ No newline at end of file
+	fmt.Println(math.Pi) // notice the capital 'P'
+}

M basics/packages-variables-functions/1.1.4_functions.go => basics/packages-variables-functions/1.1.4_functions.go +1 -1
@@ 17,4 17,4 @@ func add(x int, y int) int {
 
 func main() {
 	fmt.Println(add(42, 13))
-}>
\ No newline at end of file
+}

M basics/packages-variables-functions/1.1.5_functions-continued.go => basics/packages-variables-functions/1.1.5_functions-continued.go +2 -2
@@ 9,10 9,10 @@ package main
 
 import "fmt"
 
-func add(x, y int) int {	// this, instead of: func add(x int, y int) int {
+func add(x, y int) int { // this, instead of: func add(x int, y int) int {
 	return x + y
 }
 
 func main() {
 	fmt.Println(add(42, 13))
-}>
\ No newline at end of file
+}

M basics/packages-variables-functions/1.1.6_multiple-results.go => basics/packages-variables-functions/1.1.6_multiple-results.go +2 -2
@@ 10,11 10,11 @@ package main
 
 import "fmt"
 
-func swap(x, y string) (string, string) {	// returning 2 strings
+func swap(x, y string) (string, string) { // returning 2 strings
 	return y, x
 }
 
 func main() {
 	a, b := swap("hello", "world")
 	fmt.Println(a, b)
-}>
\ No newline at end of file
+}

M basics/packages-variables-functions/1.1.7_named-results.go => basics/packages-variables-functions/1.1.7_named-results.go +2 -2
@@ 16,9 16,9 @@ import "fmt"
 func split(sum int) (x, y int) {
 	x = sum * 4 / 9
 	y = sum - x
-	return				// the naked return
+	return // the naked return
 }
 
 func main() {
 	fmt.Println(split(17))
-}>
\ No newline at end of file
+}

M basics/packages-variables-functions/1.1.8_variables.go => basics/packages-variables-functions/1.1.8_variables.go +3 -3
@@ 9,9 9,9 @@ package main
 
 import "fmt"
 
-var c, python, java bool	// create 3 booleans
+var c, python, java bool // create 3 booleans
 
 func main() {
-	var i int				// create an int named i
+	var i int // create an int named i
 	fmt.Println(i, c, python, java)
-}>
\ No newline at end of file
+}

M basics/packages-variables-functions/1.1.9_variables-with-initializers.go => basics/packages-variables-functions/1.1.9_variables-with-initializers.go +1 -1
@@ 15,4 15,4 @@ var i, j int = 1, 2
 func main() {
 	var c, python, java = true, false, "no!"
 	fmt.Println(i, j, c, python, java)
-}>
\ No newline at end of file
+}