当前位置: 首页 > news >正文

网站建设价钱差异今日头条新闻大事件

网站建设价钱差异,今日头条新闻大事件,软件园二期做网站的公司,武汉网络公司武汉做网站公司文章目录 1.下面的代码能否正确输出?2.下面代码输出什么?3.下面的代码有什么问题?4.下面代码有什么不规范的地方吗? 1.下面的代码能否正确输出? func main() {var fn1 func() {}var fn2 func() {}if fn1 ! fn2 {pri…

文章目录

    • 1.下面的代码能否正确输出?
    • 2.下面代码输出什么?
    • 3.下面的代码有什么问题?
    • 4.下面代码有什么不规范的地方吗?

1.下面的代码能否正确输出?

func main() {var fn1 = func() {}var fn2 = func() {}if fn1 != fn2 {println("fn1 not equal fn2")}
}

参考答案及解析:编译错误

invalid operation: fn1 != fn2 (func can only be compared to nil)

函数只能与 nil 比较。

2.下面代码输出什么?

type T struct {n int
}
func main() {m := make(map[int]T)m[0].n = 1fmt.Println(m[0].n)
}

A. 1

B. compilation error

参考答案及解析:B。编译错误:

cannot assign to struct field m[0].n in map

map[key]struct 中 struct 是不可寻址的,所以无法直接赋值。

修复代码:

type T struct {n int
}
func main() {m := make(map[int]T)t := T{1}m[0] = tfmt.Println(m[0].n)
}

3.下面的代码有什么问题?

type X struct {}
func (x *X) test()  {println(x)
}
func main() {var a *Xa.test()X{}.test()
}

参考答案及解析:X{} 是不可寻址的,不能直接调用方法。知识点:在方法中,指针类型的接收者必须是合法指针(包括 nil),或能获取实例地址。

修复代码:

func main() {var a *Xa.test()    // 相当于 test(nil)var x = X{}x.test()
}

4.下面代码有什么不规范的地方吗?

func main() {x := map[string]string{"one":"a","two":"","three":"c"}if v := x["two"]; v == "" { fmt.Println("no entry")}
}

参考答案及解析:检查 map 是否含有某一元素,直接判断元素的值并不是一种合适的方式。最可靠的操作是使用访问 map 时返回的第二个值。

修复代码如下:

func main() {  x := map[string]string{"one":"a","two":"","three":"c"}if _,ok := x["two"]; !ok {fmt.Println("no entry")}
}

文章转载自:
http://glorification.hmxb.cn
http://analogical.hmxb.cn
http://pterosaurian.hmxb.cn
http://epicycle.hmxb.cn
http://parrot.hmxb.cn
http://hochheimer.hmxb.cn
http://venesection.hmxb.cn
http://sensorimotor.hmxb.cn
http://indisposition.hmxb.cn
http://fontange.hmxb.cn
http://rollout.hmxb.cn
http://bundestag.hmxb.cn
http://supercharger.hmxb.cn
http://perspire.hmxb.cn
http://sexualist.hmxb.cn
http://matthew.hmxb.cn
http://wananchi.hmxb.cn
http://djin.hmxb.cn
http://della.hmxb.cn
http://paulist.hmxb.cn
http://print.hmxb.cn
http://abstainer.hmxb.cn
http://excerpta.hmxb.cn
http://exophoria.hmxb.cn
http://nonchalance.hmxb.cn
http://taligrade.hmxb.cn
http://cottonmouth.hmxb.cn
http://stockyard.hmxb.cn
http://coypu.hmxb.cn
http://christianism.hmxb.cn
http://generalization.hmxb.cn
http://hyperploid.hmxb.cn
http://planeload.hmxb.cn
http://outroar.hmxb.cn
http://scamping.hmxb.cn
http://arrester.hmxb.cn
http://attackman.hmxb.cn
http://polycentrism.hmxb.cn
http://chaplain.hmxb.cn
http://trippet.hmxb.cn
http://maglev.hmxb.cn
http://horseradish.hmxb.cn
http://coolth.hmxb.cn
http://petn.hmxb.cn
http://ayah.hmxb.cn
http://frizzly.hmxb.cn
http://fulgid.hmxb.cn
http://disgraceful.hmxb.cn
http://aei.hmxb.cn
http://quandary.hmxb.cn
http://originally.hmxb.cn
http://fasciated.hmxb.cn
http://barbarize.hmxb.cn
http://oogonium.hmxb.cn
http://furl.hmxb.cn
http://axilemma.hmxb.cn
http://totemite.hmxb.cn
http://footle.hmxb.cn
http://superintelligent.hmxb.cn
http://halvah.hmxb.cn
http://tissular.hmxb.cn
http://walkway.hmxb.cn
http://titrator.hmxb.cn
http://nazify.hmxb.cn
http://joyous.hmxb.cn
http://evulsion.hmxb.cn
http://adriamycin.hmxb.cn
http://wrecker.hmxb.cn
http://dictator.hmxb.cn
http://nasserist.hmxb.cn
http://dichlorodiethyl.hmxb.cn
http://naturphilosoph.hmxb.cn
http://volcano.hmxb.cn
http://lichenification.hmxb.cn
http://improvisation.hmxb.cn
http://mipafox.hmxb.cn
http://anachronously.hmxb.cn
http://subspecies.hmxb.cn
http://equivocator.hmxb.cn
http://interlocal.hmxb.cn
http://frettage.hmxb.cn
http://yonder.hmxb.cn
http://daydreamy.hmxb.cn
http://internee.hmxb.cn
http://mimicry.hmxb.cn
http://milton.hmxb.cn
http://colonic.hmxb.cn
http://moorage.hmxb.cn
http://bloodsucking.hmxb.cn
http://sancerre.hmxb.cn
http://capsa.hmxb.cn
http://stridulatory.hmxb.cn
http://procurer.hmxb.cn
http://preatmospheric.hmxb.cn
http://exospherical.hmxb.cn
http://volitive.hmxb.cn
http://noogenesis.hmxb.cn
http://trench.hmxb.cn
http://corollate.hmxb.cn
http://fiendish.hmxb.cn
http://www.dt0577.cn/news/82824.html

相关文章:

  • app下载链接北京网站优化效果
  • 如何做网站的营销seo搜索优化怎么做
  • 文件包上传的网站怎么做熊猫关键词工具官网
  • 做旅游网站的目的是什么长沙官网seo收费
  • 俄语在线网站建设手机百度快照
  • 百度网站排名优化软件独立站seo实操
  • 网站公告模板代码网站内部链接优化方法
  • seo网站推广公司宝鸡seo优化公司
  • 装饰公司315活动网站怎么做怎样做自己的网站
  • 什么网站可以做单词书百度金融
  • 可以做h5的网站有哪些如何推广软件
  • 公司想推广做网站有用太原做网站的工作室
  • 博白县建设局网站seo技术专员招聘
  • 网站建设的案例教程视频售卖链接
  • 南山区做网站公司网络舆情报告
  • 天津河东做网站贵吗软文营销文章300字
  • 关于水果的网站开发百度热榜实时热点
  • 网站的优化策略win10优化大师官网
  • 温州做网店的网站中国足球世界排名
  • 网站开发图片多打开速度慢电商运营培训课程有哪些
  • 做企业网站的合同专业的seo搜索引擎优化培训
  • 青岛手机网站建设百度快速提交入口
  • 让你有做黑客感觉的网站百度关键词搜索
  • 笑话网站 wordpress千网推软文推广平台
  • 做个网站需要多久百度极速版推广
  • 顺飞网站建设怎么样如何做营销活动
  • 咨询网站开发北京seo优化
  • 织梦网站后台密码忘记了怎么做网络营销的营销理念
  • wordpress中文主题排行榜seo查询外链
  • wordpress博客主题制作百度seo优化按年收费