Skip to content

Commit 5641fcc

Browse files
committed
clean-up
1 parent bd692a2 commit 5641fcc

File tree

1 file changed

+32
-31
lines changed

1 file changed

+32
-31
lines changed

README.md

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -420,13 +420,13 @@ package main
420420
import "fmt"
421421

422422
func double(i int) {
423-
i = i * 2
423+
i = i * 2
424424
}
425425

426426
func main() {
427-
i := 2
428-
double(i)
429-
fmt.Printf("i = %v\n", i)
427+
i := 2
428+
double(i)
429+
fmt.Printf("i = %v\n", i)
430430
}
431431
```
432432

@@ -438,13 +438,13 @@ package main
438438
import "fmt"
439439

440440
func double(i *int) {
441-
*i = *i * 2
441+
*i = *i * 2
442442
}
443443

444444
func main() {
445-
i := 2
446-
double(&i)
447-
fmt.Printf("i = %v\n", i)
445+
i := 2
446+
double(&i)
447+
fmt.Printf("i = %v\n", i)
448448
}
449449
```
450450

@@ -469,11 +469,11 @@ func main() {
469469
width: 4.0,
470470
}
471471
fmt.Printf("square has area of %v\n", square.height * square.width)
472-
}
472+
}
473473
```
474474

475475
* A struct is like a final class in Java.
476-
* Variables starting with a upper case letter are public, variables starting with lower case letter are package private.
476+
* Variables starting with an upper case letter are public, variables starting with a lower case letter are package private.
477477

478478
26 Methods
479479
----------
@@ -555,15 +555,15 @@ Go has some pre-defined interfaces. The most important ones are:
555555

556556
```go
557557
type Stringer interface {
558-
String() string
558+
String() string
559559
}
560560
```
561561

562562
Like Java's `toString()`
563563

564564
```go
565565
type error interface {
566-
Error() string
566+
Error() string
567567
}
568568
```
569569

@@ -578,15 +578,16 @@ The following code:
578578

579579
```go
580580
func main() {
581-
c := &circle{
582-
radius: 2.0,
583-
}
584-
r := &rectangle{
585-
width: 4.0,
586-
height: 4.0,
587-
}
588-
fmt.Printf("Shape 1: %v\n", c)
589-
fmt.Printf("Shape 2: %v\n", r) }
581+
c := &circle{
582+
radius: 2.0,
583+
}
584+
r := &rectangle{
585+
width: 4.0,
586+
height: 4.0,
587+
}
588+
fmt.Printf("Shape 1: %v\n", c)
589+
fmt.Printf("Shape 2: %v\n", r)
590+
}
590591
```
591592

592593
Should produce the following output:
@@ -746,15 +747,15 @@ Write a function `combine()` such that
746747

747748
```go
748749
func main() {
749-
add := func(a, b int) int {
750-
return a + b
751-
}
752-
mult := func(a, b int) int {
753-
return a * b
754-
}
755-
arr := createArray(10)
756-
fmt.Printf("add(1..10)=%v\n", combine(arr, add))
757-
fmt.Printf("mult(1..10)=%v\n", combine(arr, mult))
750+
add := func(a, b int) int {
751+
return a + b
752+
}
753+
mult := func(a, b int) int {
754+
return a * b
755+
}
756+
arr := createArray(10)
757+
fmt.Printf("add(1..10)=%v\n", combine(arr, add))
758+
fmt.Printf("mult(1..10)=%v\n", combine(arr, mult))
758759
}
759760
```
760761

@@ -944,7 +945,7 @@ func main() {
944945
46 Exercise
945946
-----------
946947

947-
Include a unique number in each respone:
948+
Include a unique number in each response:
948949

949950
* First response gets number 1
950951
* Second response gets number 2

0 commit comments

Comments
 (0)