当前位置:网站首页>Go语言自学系列 | golang中的if else语句
Go语言自学系列 | golang中的if else语句
2022-07-03 15:34:00 【51CTO】
视频来源:B站《golang入门到项目实战 [2021最新Go语言教程,没有废话,纯干货!持续更新中...]》
一边学习一边整理老师的课程内容及试验笔记,并与大家分享,侵权即删,谢谢支持!
附上汇总贴: Go语言自学系列 | 汇总_COCOgsta的博客-CSDN博客
go语言中的if else语句可以根据给定条件二选一。
go语言的if else语句语法
go语言if else语句实例
比较两个数的大小
运行结果
判断一个数是奇数还是偶数
运行结果
判断一个人是否成年
运行结果
特殊写法,在if前面添加执行语句
运行结果
go语言if语句使用提示:
- 不需使用括号将条件包含起来
- 大括号{}必须存在,即使只有一行语句
- 左括号必须在if或else的同一行
- 在if之后,条件语句之前,可以添加变量初始化语句,使用;进行分隔
边栏推荐
- Win10 enterprise 2016 long term service activation tutorial
- Puppet自动化运维排错案例
- Srs4.0+obs studio+vlc3 (environment construction and basic use demonstration)
- 驱动与应用程序通信
- 秒殺系統3-商品列錶和商品詳情
- Kubernetes - YAML文件解读
- Digital image processing -- popular understanding of corrosion and expansion
- Halcon与Winform学习第一节
- Characteristics of MySQL InnoDB storage engine -- Analysis of row lock
- 【日常训练】395. 至少有 K 个重复字符的最长子串
猜你喜欢

Wechat payment -jsapi: code implementation (payment asynchronous callback, Chinese parameter solution)

Subclass hides the function with the same name of the parent class

CString getbuffer and releasebuffer instructions

Introduction, use and principle of synchronized

App移动端测试【3】ADB命令
![[probably the most complete in Chinese] pushgateway entry notes](/img/5a/6dcb75f5d713ff513ad6842ff53cc3.png)
[probably the most complete in Chinese] pushgateway entry notes

redis缓存穿透,缓存击穿,缓存雪崩解决方案

Idea does not specify an output path for the module

Second kill system 3 - list of items and item details

视觉上位系统设计开发(halcon-winform)-4.通信管理
随机推荐
Creation and destruction of function stack frames
Visual upper system design and development (Halcon WinForm) -4 Communication management
Download and install common programs using AUR
Relationship between truncated random distribution and original distribution
The state does not change after the assignment of El switch
[cloud native training camp] module VIII kubernetes life cycle management and service discovery
Using Tengine to solve the session problem of load balancing
《微服务设计》读书笔记(上)
秒杀系统3-商品列表和商品详情
Basic SQL tutorial
视觉上位系统设计开发(halcon-winform)-5.相机
Redis主从、哨兵、集群模式介绍
找映射关系
The difference between mutually exclusive objects and critical areas
Vs2017 is driven by IP debugging (dual machine debugging)
CString中使用百分号
The wonderful use of do{}while()
How are integer and floating-point types stored in memory
Kubernetes - yaml file interpretation
驱动与应用程序通信