当前位置:网站首页>Go language self-study series | if else statement in golang
Go language self-study series | if else statement in golang
2022-07-03 15:41:00 【51CTO】
Video source :B standing 《golang Introduction to project practice [2021 newest Go Language course , There is no nonsense , Dry only ! Ongoing update ...]》
Organize the teacher's course content and test notes while studying , And share it with you , Infringement is deleted , Thank you for your support !
Attach summary sticker : Go Language self-study series | Summary _COCOgsta The blog of -CSDN Blog
go In language if else Statement can be selected according to a given condition .
go Linguistic if else Sentence syntax
go Language if else Statement instance
Compare the size of two numbers
Running results
Judge whether a number is odd or even
package main
import "fmt"
func f2() {
var s int
fmt.Println(" Enter a number :")
fmt.Scan(&s)
if s%2 == 0 {
fmt.Print("s It's even \n")
} else {
fmt.Print("s Not even numbers \n")
}
fmt.Print("s The value of is :", s)
}
func main() {
f2()
}
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
Running results
Judging whether a person is an adult
Running results
Special way of writing , stay if Add execution statement before
Running results
go Language if Statement use prompt :
- You do not need parentheses to enclose conditions
- Curly braces {} There must be , Even if there is only one line of statement
- The left parenthesis must be in if or else On the same line
- stay if after , Before conditional statement , You can add variable initialization statements , Use ; separation
边栏推荐
- A Fei's expectation
- Shell script import and export data
- VS2017通过IP调试驱动(双机调试)
- UnityShader——MaterialCapture材质捕捉效果 (翡翠斧头)
- App移动端测试【3】ADB命令
- Enable multi-threaded download of chrome and edge browsers
- Baidu AI Cloud helps Shizuishan upgrade the smart health care model of "Internet + elderly care services"
- Atlas atlas torque gun USB communication tutorial based on mtcom
- QT common sentence notes
- Persisting in output requires continuous learning
猜你喜欢

qt使用QZxing生成二维码

Unity功能——Unity离线文档下载及使用

UnityShader——MaterialCapture材质捕捉效果 (翡翠斧头)

Redis lock Optimization Practice issued by gaobingfa

WinDbg分析dump文件

Summary of concurrent full knowledge points

Jvm-08-garbage collector

找映射关系

Detailed pointer advanced 1

Vs2017 is driven by IP debugging (dual machine debugging)
随机推荐
Halcon与Winform学习第一节
Kubernetes vous emmène du début à la fin
Microservice - declarative interface call openfeign
详解指针进阶2
Visual upper system design and development (Halcon WinForm) -1 Process node design
Location of software installation information and system services in the registry
How are integer and floating-point types stored in memory
C语言刷题~Leetcode与牛客网简单题
Unity功能——Unity离线文档下载及使用
关于网页中的文本选择以及统计选中文本长度
Redis lock Optimization Practice issued by gaobingfa
秒杀系统1-登录功能
C language brush questions ~leetcode and simple questions of niuke.com
[cloud native training camp] module 7 kubernetes control plane component: scheduler and controller
Analysis of development mode process based on SVN branch
How to use annotations such as @notnull to verify and handle global exceptions
如何使用 @NotNull等注解校验 并全局异常处理
坚持输出需要不断学习
The difference between mutually exclusive objects and critical areas
Enable multi-threaded download of chrome and edge browsers