mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 17:41:41 +00:00
Minor Typos, increased readability
This commit is contained in:
parent
6ac7368b3b
commit
6a2fe434b8
@ -10,6 +10,7 @@ contributors:
|
|||||||
- ["Quint Guvernator", "https://github.com/qguv"]
|
- ["Quint Guvernator", "https://github.com/qguv"]
|
||||||
- ["Jose Donizetti", "https://github.com/josedonizetti"]
|
- ["Jose Donizetti", "https://github.com/josedonizetti"]
|
||||||
- ["Alexej Friesen", "https://github.com/heyalexej"]
|
- ["Alexej Friesen", "https://github.com/heyalexej"]
|
||||||
|
- ["Clayton Walker", "https://github.com/cwalk"]
|
||||||
---
|
---
|
||||||
|
|
||||||
Go was created out of the need to get work done. It's not the latest trend
|
Go was created out of the need to get work done. It's not the latest trend
|
||||||
@ -115,7 +116,7 @@ can include line breaks.` // Same string type.
|
|||||||
fmt.Println(s) // Updated slice is now [1 2 3 4 5 6]
|
fmt.Println(s) // Updated slice is now [1 2 3 4 5 6]
|
||||||
// To append another slice, instead of list of atomic elements we can
|
// To append another slice, instead of list of atomic elements we can
|
||||||
// pass a reference to a slice or a slice literal like this, with a
|
// pass a reference to a slice or a slice literal like this, with a
|
||||||
// trailing elipsis, meaning take a slice and unpack its elements,
|
// trailing ellipsis, meaning take a slice and unpack its elements,
|
||||||
// appending them to slice s.
|
// appending them to slice s.
|
||||||
s = append(s, []int{7, 8, 9}...) // Second argument is a slice literal.
|
s = append(s, []int{7, 8, 9}...) // Second argument is a slice literal.
|
||||||
fmt.Println(s) // Updated slice is now [1 2 3 4 5 6 7 8 9]
|
fmt.Println(s) // Updated slice is now [1 2 3 4 5 6 7 8 9]
|
||||||
@ -129,7 +130,7 @@ can include line breaks.` // Same string type.
|
|||||||
m["one"] = 1
|
m["one"] = 1
|
||||||
|
|
||||||
// Unused variables are an error in Go.
|
// Unused variables are an error in Go.
|
||||||
// The underbar lets you "use" a variable but discard its value.
|
// The underscore lets you "use" a variable but discard its value.
|
||||||
_, _, _, _, _, _, _, _, _, _ = str, s2, g, f, u, pi, n, a3, s4, bs
|
_, _, _, _, _, _, _, _, _, _ = str, s2, g, f, u, pi, n, a3, s4, bs
|
||||||
// Output of course counts as using a variable.
|
// Output of course counts as using a variable.
|
||||||
fmt.Println(s, c, a4, s3, d2, m)
|
fmt.Println(s, c, a4, s3, d2, m)
|
||||||
@ -164,7 +165,7 @@ func expensiveComputation() float64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func learnFlowControl() {
|
func learnFlowControl() {
|
||||||
// If statements require brace brackets, and do not require parens.
|
// If statements require brace brackets, and do not require parentheses.
|
||||||
if true {
|
if true {
|
||||||
fmt.Println("told ya")
|
fmt.Println("told ya")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user