Format and remove en/02.x.md spaces

This commit is contained in:
vCaesar
2017-07-01 00:02:17 +08:00
parent 2859b37818
commit c93ed673b2
3 changed files with 37 additions and 37 deletions

View File

@@ -33,15 +33,15 @@ There are three more ways to define a struct.
- Assign initial values by order
```Go
P := person{"Tom", 25}
P := person{"Tom", 25}
```
- Use the format `field:value` to initialize the struct without order
```Go
P := person{age:24, name:"Bob"}
P := person{age:24, name:"Bob"}
```
- Define an anonymous struct, then initialize it
```Go
P := struct{name string; age int}{"Amy",18}
P := struct{name string; age int}{"Amy",18}
```
Let's see a complete example.
```Go
@@ -141,8 +141,8 @@ Figure 2.7 Embedding in Student and Human
We see that we can access the `age` and `name` fields in Student just like we can in Human. This is how embedded fields work. It's very cool, isn't it? Hold on, there's something cooler! You can even use Student to access Human in this embedded field!
```Go
mark.Human = Human{"Marcus", 55, 220}
mark.Human.age -= 1
mark.Human = Human{"Marcus", 55, 220}
mark.Human.age -= 1
```
All the types in Go can be used as embedded fields.
```Go