Fix typos in c2.2 of the English version

This commit is contained in:
digitalcraftsman
2015-08-27 16:05:07 +02:00
committed by James Miranda
parent 45296e0e74
commit 9e8c55ec06

View File

@@ -107,7 +107,7 @@ Although int32 has a longer length than int8, and has the same type as int, you
Float types have the `float32` and `float64` types and no type called `float`. The latter one is the default type if using brief statement.
That's all? No! Go supports complex numbers as well. `complex128` (with a 64-bit real and 64-bit imaginary part) is the default type, if you need a smaller type, there is one called `complex64` (with a 32-bit real and 32-bit imaginary part). Its form is `RE+IMi`, where `RE` is real part and `IM` is imaginary part, the last `i` is imaginary number. There is a example of complex number.
That's all? No! Go supports complex numbers as well. `complex128` (with a 64-bit real and 64-bit imaginary part) is the default type, if you need a smaller type, there is one called `complex64` (with a 32-bit real and 32-bit imaginary part). Its form is `RE+IMi`, where `RE` is real part and `IM` is imaginary part, the last `i` is the imaginary number. There is a example of complex number.
var c complex64 = 5+5i
//output: (5+5i)
@@ -126,12 +126,12 @@ We just talked about how Go uses the UTF-8 character set. Strings are represente
frenchHello = "Bonjour" // basic form of assign values
}
It's impossible to change string values by index. You will get errors when you compile following code.
It's impossible to change string values by index. You will get errors when you compile the following code.
var s string = "hello"
s[0] = 'c'
What if I really want to change just one character in a string? Try following code.
What if I really want to change just one character in a string? Try the following code.
s := "hello"
c := []byte(s) // convert string to []byte type
@@ -170,7 +170,7 @@ Go has one `error` type for purpose of dealing with error messages. There is als
### Underlying data structure
The following picture comes from an article about [Go data structure](http://research.swtch.com/godata) in [Russ Cox Blog](http://research.swtch.com/). As you can see, Go utilizes blocks of memory to store data.
The following picture comes from an article about [Go data structure](http://research.swtch.com/godata) in [Russ Cox's Blog](http://research.swtch.com/). As you can see, Go utilizes blocks of memory to store data.
![](images/2.2.basic.png?raw=true)