难道是我想简单化了???
val := fibonacci(i)
fmt.Printf("%d ", val)
defer fmt.Printf("%d ", val)
val := fibonacci(i)
fmt.Printf("%d ", val)
defer fmt.Printf("%d ", val)
2018-03-21
最赞回答 / 就是不服_
```package mainimport "fmt"func main() { var numbers4 = [...]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10} // 切片下标4~6 容量上界到8 // slice5 = [5 6] * *, 实际长度为2 容量为4 // 后面两个*代表上界最多扩容到下标8 [5,6,7,8] slice5 := numbers4[4:6:8] length := (2) ...
2018-03-21
for i := 1; i < 5; i++ {
fmt.Printf("%d: %s\n", i, map1[i])
}
fmt.Printf("%d: %s\n", i, map1[i])
}
2018-03-21
Mendick,你好,你的答案看似对的,其实没读,以为“math/rand”是伪随机,每次执行的结果都是1,所以取模后的结果还是1,所以不会有0的出现,也就对了,这个栗子真坑人……
2018-03-21
type Person struct {
Name string
Gender string
Age uint8
Address string
}
func (person *Person) Move(newAddr string) string {
oldAddress := person.Address
person.Address = newAddr
return oldAddress
}
Name string
Gender string
Age uint8
Address string
}
func (person *Person) Move(newAddr string) string {
oldAddress := person.Address
person.Address = newAddr
return oldAddress
}
2018-03-20
37行处填入:
generator = func (company string, department string, sn uint32) string{
return appendSn((company + "-" + department + "-"), sn)
}
generator = func (company string, department string, sn uint32) string{
return appendSn((company + "-" + department + "-"), sn)
}
2018-03-20
fmt.Printf("用解释型字符串表示法表示的 %q 所代表的是 %s。\n", str1, `1`)
这个都成功了,是不是任何字符都可以
这个都成功了,是不是任何字符都可以
2018-03-17
func myfunc(company string, department string, sn uint32) string{
return appendSn(company + "-" + department + "-",sn)
}
func main() {
var generator EmployeeIdGenerator
generator = myfunc
fmt.Println(generateId(generator, "RD"))
}
return appendSn(company + "-" + department + "-",sn)
}
func main() {
var generator EmployeeIdGenerator
generator = myfunc
fmt.Println(generateId(generator, "RD"))
}
2018-03-16