Use tabs as the canonical source indentation in git
Space conversion is done during generation only. Fixes #192
This commit is contained in:
committed by
Mark McGranaghan
parent
1699ad1c45
commit
7c160440be
@@ -10,24 +10,24 @@ import "fmt"
|
||||
// Here's a function that will take an arbitrary number
|
||||
// of `int`s as arguments.
|
||||
func sum(nums ...int) {
|
||||
fmt.Print(nums, " ")
|
||||
total := 0
|
||||
for _, num := range nums {
|
||||
total += num
|
||||
}
|
||||
fmt.Println(total)
|
||||
fmt.Print(nums, " ")
|
||||
total := 0
|
||||
for _, num := range nums {
|
||||
total += num
|
||||
}
|
||||
fmt.Println(total)
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
// Variadic functions can be called in the usual way
|
||||
// with individual arguments.
|
||||
sum(1, 2)
|
||||
sum(1, 2, 3)
|
||||
// Variadic functions can be called in the usual way
|
||||
// with individual arguments.
|
||||
sum(1, 2)
|
||||
sum(1, 2, 3)
|
||||
|
||||
// If you already have multiple args in a slice,
|
||||
// apply them to a variadic function using
|
||||
// `func(slice...)` like this.
|
||||
nums := []int{1, 2, 3, 4}
|
||||
sum(nums...)
|
||||
// If you already have multiple args in a slice,
|
||||
// apply them to a variadic function using
|
||||
// `func(slice...)` like this.
|
||||
nums := []int{1, 2, 3, 4}
|
||||
sum(nums...)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user