type Cat struct {
name string
age int
location string
}
func (cat Cat) Grow(){
fmt.Println("grow")
}
func (cat *Cat) Move(newLocation string) (oldLocation string) {
cat.location, oldLocation = newLocation, cat.location
return
}
name string
age int
location string
}
func (cat Cat) Grow(){
fmt.Println("grow")
}
func (cat *Cat) Move(newLocation string) (oldLocation string) {
cat.location, oldLocation = newLocation, cat.location
return
}
2018-04-26
type Person struct {
Name string
Gender string
Age uint8
Address string
}
func (p *Person) Move(newAddress string) string {
oldAddress := p.Address
p.Address = newAddress
return oldAddress
}
Name string
Gender string
Age uint8
Address string
}
func (p *Person) Move(newAddress string) string {
oldAddress := p.Address
p.Address = newAddress
return oldAddress
}
2018-04-18
type Pet interface {
Name() string
Age() uint8
}
type Dog struct {
N string
A uint8
}
func (dog Dog) Name() (string){
return dog.N
}
func (dog Dog) Age() (uint8){
return dog.A
}
func main() {
}
Name() string
Age() uint8
}
type Dog struct {
N string
A uint8
}
func (dog Dog) Name() (string){
return dog.N
}
func (dog Dog) Age() (uint8){
return dog.A
}
func main() {
}
2018-04-18
package main
import "fmt"
func main() {
...
...
length := (2)
capacity := (4)
...
...
...
length = (7)
...
...
...
e2 := (0)
e3 := (8)
e4 := (11)
...
}
記得加前兩行
import "fmt"
func main() {
...
...
length := (2)
capacity := (4)
...
...
...
length = (7)
...
...
...
e2 := (0)
e3 := (8)
e4 := (11)
...
}
記得加前兩行
2018-04-17
建議還是先看下基礎(比如w3c),有了一定認識之后,來著做一下深化,老師已經講的很透很全了,而且每個概念時間很短,建議把這個當成一個加深理解的教程,而不是go語言從入門到xxx
2018-04-14
var (
num1 int
num2 int
num3 int
num4 int = 4
num5 int = 5
num6 int = 6
)
num1, num2, num3 = 1, 2, 3
var num7 ,num8 ,num9 int = 7,8,9
num1 int
num2 int
num3 int
num4 int = 4
num5 int = 5
num6 int = 6
)
num1, num2, num3 = 1, 2, 3
var num7 ,num8 ,num9 int = 7,8,9
2018-04-13