加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

golang学习的点点滴滴:if、switch使用

发布时间:2020-12-16 18:49:31 所属栏目:大数据 来源:网络整理
导读:funcmain(){ifa:=0;a==0{fmt.Println(a)}fmt.Println("-----")b:=0switchb{case1:fmt.Println(1)case0:fallthroughcase2:fmt.Println("heihei")}fmt.Println("-----")switch{caseb1b10:fmt.Println("hahah")caseb-2b3:fmt.Println("ok")}}
funcmain(){
	ifa:=0;a==0{
		fmt.Println(a)
	}

	fmt.Println("-----")

	b:=0
	switchb{
		case1:
			fmt.Println(1)
		case0:
			fallthrough
		case2:
			fmt.Println("heihei")
	}

	fmt.Println("-----")

	switch{
		caseb>1&&b<10:
			fmt.Println("hahah")
		caseb>-2&&b<3:
			fmt.Println("ok")
	}
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读