当前位置:网站首页>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
边栏推荐
- CString在多线程中的问题
- Custom annotation
- Jvm-05-object, direct memory, string constant pool
- Tensorflow realizes verification code recognition (III)
- Win32 create window and button (lightweight)
- Use percent sign in CString
- Summary of JVM knowledge points
- Detailed pointer advanced 1
- Seckill system 3- product list and product details
- Microservices - load balancing ribbon
猜你喜欢
需要知道的字符串函数
Tensorflow realizes verification code recognition (I)
秒杀系统3-商品列表和商品详情
[系统安全] 四十三.Powershell恶意代码检测系列 (5)抽象语法树自动提取万字详解
Visual upper system design and development (Halcon WinForm) -3 Image control
App移动端测试【5】文件的写入、读取
Vs2017 is driven by IP debugging (dual machine debugging)
Redis cache penetration, cache breakdown, cache avalanche solution
Redis lock Optimization Practice issued by gaobingfa
Unityshader - materialcapture material capture effect (Emerald axe)
随机推荐
CString的GetBuffer和ReleaseBuffer使用说明
UnityShader——MaterialCapture材质捕捉效果 (翡翠斧头)
QT common sentence notes
自定义注解
软件安装信息、系统服务在注册表中的位置
The markdown file obtains the pictures of the network and stores them locally and modifies the URL
坚持输出需要不断学习
Detailed pointer advanced 2
Halcon and WinForm study section 1
Create gradle project
Digital image processing -- popular understanding of corrosion and expansion
Qt常用语句备忘
Win32 create window and button (lightweight)
Vs2017 is driven by IP debugging (dual machine debugging)
How are integer and floating-point types stored in memory
Baidu AI Cloud helps Shizuishan upgrade the smart health care model of "Internet + elderly care services"
Backtracking method to solve batch job scheduling problem
The difference between RAR and zip files
QT use qzxing to generate QR code
CString getbuffer and releasebuffer instructions