var 目标变量 = 源变量[开始索引:结束索引]
目标变量的长度是源变量的 (结束索引 - 开始索引)
目标变量的容量是源变量的 (容量 - 开始索引)
目标变量的长度是源变量的 (结束索引 - 开始索引)
目标变量的容量是源变量的 (容量 - 开始索引)
2021-11-28
generator = func (company string, department string, sn uint32) string{
var name = company+"-"+department+"-"
return appendSn(name,sn)
}
var name = company+"-"+department+"-"
return appendSn(name,sn)
}
2021-11-26
func myfunc(company string, department string, sn uint32) string{
var name = company+"-"+department+"-"
return appendSn(name,sn)
}
generator = myfunc
var name = company+"-"+department+"-"
return appendSn(name,sn)
}
generator = myfunc
2021-11-26
package main
import "fmt"
func main() {
ch2 := make(chan string, 1)
go func() {
ch2 <- ("已到达!")
}()
var value string = "数据"
// val := <- ch2
// value = value + val
value=value+(<-ch2)
fmt.Println(value)
}
import "fmt"
func main() {
ch2 := make(chan string, 1)
go func() {
ch2 <- ("已到达!")
}()
var value string = "数据"
// val := <- ch2
// value = value + val
value=value+(<-ch2)
fmt.Println(value)
}
2021-11-23
只加这一行貌似更简单
defer func(reverse_fi int){
fmt.Printf("%d ", reverse_fi)
}(fibonacci(i))
defer func(reverse_fi int){
fmt.Printf("%d ", reverse_fi)
}(fibonacci(i))
2021-01-21
func main() {
go func() {
fmt.Println("1")
}()
go func() {
time.Sleep(100 * time.Millisecond)
fmt.Println("2")
}()
go func() {
time.Sleep(200 * time.Millisecond)
fmt.Println("3")
}()
time.Sleep(500 * time.Millisecond)
}
go func() {
fmt.Println("1")
}()
go func() {
time.Sleep(100 * time.Millisecond)
fmt.Println("2")
}()
go func() {
time.Sleep(200 * time.Millisecond)
fmt.Println("3")
}()
time.Sleep(500 * time.Millisecond)
}
2021-01-14