package main import "fmt" var a int var b int func modify(array [5]int) { array[len(array)-1] = 100 fmt.Println("in modify(),array values:", array) } func slices(){ fmt.Print("slices is ok") } func main(){ array := [5] int{1,2,3,4,55} fmt.Println("*" ) array[0] = 10 for i,v := range array{ fmt.Println("Array element[",i,"]=",v) } modify(array) fmt.Println(array[len(array)-1]) fmt.Println("in main(), array values:", array) /* for a := 0;a<=100;a++{ for b := 0;b<=10;b++{ fmt.Println("number is:",a) fmt.Println("number is:",a+b) fmt.Print("aaa" ) } } */ ds := "Hellow Word\t" cs := "2017-06-24" es := ds + cs //fmt.Println(es,es[len(es)]) fmt.Println("len[es]",es,ds,cs[1]) slices() }
本文出自 “欢迎评论,欢迎点赞” 博客,请务必保留此出处http://swq499809608.blog.51cto.com/797714/1920888
原文地址:http://swq499809608.blog.51cto.com/797714/1920888