if number += 4; 10 > number { // number=9,条件成立
number := 0 // 申明一个内部变量number
number += 3 // 内部number=3,外部number=9
fmt.Print(number) // 这里输出的是3,不换行
} else if 10 < number { // 条件不成立,不执行
number -= 2
fmt.Print(number)
}
fmt.Println(number) // number=9,输出9\n,与之前的输出合在一起,就是39\n
number := 0 // 申明一个内部变量number
number += 3 // 内部number=3,外部number=9
fmt.Print(number) // 这里输出的是3,不换行
} else if 10 < number { // 条件不成立,不执行
number -= 2
fmt.Print(number)
}
fmt.Println(number) // number=9,输出9\n,与之前的输出合在一起,就是39\n
2017-02-18
type Dog struct{
name string
age uint8
}
func (dog Dog) Name() string {
return dog.name
}
func (dog Dog) Age() uint8 {
return dog.age
}
name string
age uint8
}
func (dog Dog) Name() string {
return dog.name
}
func (dog Dog) Age() uint8 {
return dog.age
}
2017-02-17
package main
import (
"fmt"
)
type Sender chan<- int
type Receiver <-chan int
func main() {
fmt.Println("Received! 6 ")
fmt.Println("Sent!")
}
import (
"fmt"
)
type Sender chan<- int
type Receiver <-chan int
func main() {
fmt.Println("Received! 6 ")
fmt.Println("Sent!")
}
2017-02-10
type Cat struct {
Name string
Age uint8
Location string
}
func (cat *Cat) Grow() {
// cat.Age++
}
func (cat *Cat) Move(new string) string {
// old := cat.Location
// cat.Location = new
// return old
return ""
}
Name string
Age uint8
Location string
}
func (cat *Cat) Grow() {
// cat.Age++
}
func (cat *Cat) Move(new string) string {
// old := cat.Location
// cat.Location = new
// return old
return ""
}
2017-02-09
type Person struct {
Name string
Gender string
Age uint8
Address string
}
func (person *Person) Move(address string) string {
oldAddress := person.Address
person.Address = address
return oldAddress
}
Name string
Gender string
Age uint8
Address string
}
func (person *Person) Move(address string) string {
oldAddress := person.Address
person.Address = address
return oldAddress
}
2017-02-09
func main() {
var generator EmployeeIdGenerator
generator = func(company string, department string, sn uint32) string {
return appendSn(company+"-"+department+"-", sn)
}
fmt.Println(generateId(generator, "RD"))
}
var generator EmployeeIdGenerator
generator = func(company string, department string, sn uint32) string {
return appendSn(company+"-"+department+"-", sn)
}
fmt.Println(generateId(generator, "RD"))
}
2017-02-09
go func() {
ch2 <- ("已到达!")
}()
var value string = "数据"
value = value + (<-ch2)
fmt.Println(value)
ch2 <- ("已到达!")
}()
var value string = "数据"
value = value + (<-ch2)
fmt.Println(value)
2017-02-09
会java , PHP 也不知老师从哪儿开始讲的 能先介绍下我们该用什么编辑工具吗 配置环境什么都不知道 就在讲工作区什么命令的, 完全听不下去了
2017-02-09
想说一下前面吐槽的同学, 想看更高深的内容可以看作者的书, 比较精辟, 我是看书有很多不懂的, 才来恶补知识的~
2017-01-29