Skip to content

Commit 2859b37

Browse files
committed
Format and remove en/02.3.md spaces
1 parent 7c350f5 commit 2859b37

File tree

2 files changed

+181
-180
lines changed

2 files changed

+181
-180
lines changed

en/02.2.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,9 @@ We just talked about how Go uses the UTF-8 character set. Strings are represente
124124
var frenchHello string // basic form to define string
125125
var emptyString string = "" // define a string with empty string
126126
func test() {
127-
no, yes, maybe := "no", "yes", "maybe" // brief statement
128-
japaneseHello := "Ohaiou"
129-
frenchHello = "Bonjour" // basic form of assign values
127+
no, yes, maybe := "no", "yes", "maybe" // brief statement
128+
japaneseHello := "Ohaiou"
129+
frenchHello = "Bonjour" // basic form of assign values
130130
}
131131
```
132132
It's impossible to change string values by index. You will get errors when you compile the following code.
@@ -168,7 +168,7 @@ Go has one `error` type for purpose of dealing with error messages. There is als
168168
```Go
169169
err := errors.New("emit macho dwarf: elf header corrupted")
170170
if err != nil {
171-
fmt.Print(err)
171+
fmt.Print(err)
172172
}
173173
```
174174
### Underlying data structure
@@ -201,20 +201,20 @@ var prefix string
201201
Group form.
202202
```Go
203203
import(
204-
"fmt"
205-
"os"
204+
"fmt"
205+
"os"
206206
)
207207

208208
const(
209-
i = 100
210-
pi = 3.1415
211-
prefix = "Go_"
209+
i = 100
210+
pi = 3.1415
211+
prefix = "Go_"
212212
)
213213

214214
var(
215-
i int
216-
pi float32
217-
prefix string
215+
i int
216+
pi float32
217+
prefix string
218218
)
219219
```
220220
Unless you assign the value of constant is `iota`, the first value of constant in the group `const()` will be `0`. If following constants don't assign values explicitly, their values will be the same as the last one. If the value of last constant is `iota`, the values of following constants which are not assigned are `iota` also.
@@ -224,11 +224,11 @@ Unless you assign the value of constant is `iota`, the first value of constant i
224224
Go has one keyword called `iota`, this keyword is to make `enum`, it begins with `0`, increased by `1`.
225225
```Go
226226
const(
227-
x = iota // x == 0
228-
y = iota // y == 1
229-
z = iota // z == 2
230-
w // If there is no expression after the constants name, it uses the last expression,
231-
//so it's saying w = iota implicitly. Therefore w == 3, and y and z both can omit "= iota" as well.
227+
x = iota // x == 0
228+
y = iota // y == 1
229+
z = iota // z == 2
230+
w // If there is no expression after the constants name, it uses the last expression,
231+
//so it's saying w = iota implicitly. Therefore w == 3, and y and z both can omit "= iota" as well.
232232
)
233233

234234
const v = iota // once iota meets keyword `const`, it resets to `0`, so v = 0.
@@ -363,8 +363,8 @@ For instance, in the case of `aSlice` and `bSlice` above, if you change the valu
363363
- The length of `slice`.
364364
- Capacity, the length from start index to end index of `slice`.
365365
```Go
366-
Array_a := [10]byte{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'}
367-
Slice_a := Array_a[2:5]
366+
Array_a := [10]byte{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'}
367+
Slice_a := Array_a[2:5]
368368
```
369369
The underlying data structure of the code above as follows.
370370

@@ -419,9 +419,9 @@ rating := map[string]float32 {"C":5, "Go":4.5, "Python":4.5, "C++":2 }
419419
//exist,'ok' returns false. It returns true otherwise.
420420
csharpRating, ok := rating["C#"]
421421
if ok {
422-
fmt.Println("C# is in the map and its rating is ", csharpRating)
422+
fmt.Println("C# is in the map and its rating is ", csharpRating)
423423
} else {
424-
fmt.Println("We have no rating associated with C# in the map")
424+
fmt.Println("We have no rating associated with C# in the map")
425425
}
426426

427427
delete(rating, "C") // delete element with key "c"

0 commit comments

Comments
 (0)