![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
golang
GolangLy
探索golang的萌新
展开
-
undeclared name问题,一定要仔细啊
今天的学习中遇到了这样的问题str := "h无e敌l是l寂l寞o" count := 0 for _, s = range str { fmt.Printf("%c\n", s) if len(string(s)) >= 3 { count++ } } fmt.Printf("汉字数量为:%d", count)报错# command-line-arg...原创 2020-04-24 00:47:12 · 9794 阅读 · 0 评论 -
报错too many arguments to conversion to []string:怎么办
最近刚学习golang,在学习string的时候遇到了这样的问题。s5 := []string("how","do","you","do") fmt.Println(s5)出现报错如下可以看到,错误原因位返回值太多,这里是返回四个值。应修改为s5 := []string{"how", "do", "you", "do"} fmt.Println(s5)输出如下...原创 2020-04-18 20:10:49 · 2760 阅读 · 0 评论