当前位置:网站首页>Go language self-study series | if else if statement in golang
Go language self-study series | if else if 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 Language if Statements can be nested multiple times , Make multiple judgments .
go In language if else if grammar
go In language if else if Syntax examples
Judge the grade according to the score
Running results
It can also be written like this
Running results
Enter the first letter of the day of the week to determine the day of the week , If the first letter is the same , Then continue to judge the second letter
package main
import "fmt"
func f6() {
// Monday Tuesday Wednesday Thursday Friday Saturday Sunday
var c string
fmt.Println(" Enter a character :")
fmt.Scan(&c)
if c == "S" {
fmt.Println(" Enter the second character :")
fmt.Scan(&c)
if c == "a" {
fmt.Println("Saturday")
} else if c == "u" {
fmt.Println("Sunday")
} else {
fmt.Println(" Input error ")
}
} else if c == "F" {
fmt.Println("Friday")
} else if c == "M" {
fmt.Println("Monday")
} else if c == "T" {
fmt.Println(" Enter the second character :")
fmt.Scan(&c)
if c == "u" {
fmt.Println("Tuesday")
} else if c == "h" {
fmt.Println("Thursday")
} else {
fmt.Println(" Input error ")
}
} else if c == "W" {
fmt.Println("Wednesday")
} else {
fmt.Println(" Input error ")
}
}
func main() {
f6()
}
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
- 36.
- 37.
- 38.
- 39.
- 40.
- 41.
- 42.
- 43.
- 44.
Running results
边栏推荐
- Popular understanding of linear regression (II)
- Atlas atlas torque gun USB communication tutorial based on mtcom
- Microservice - fuse hystrix
- Kubernetes advanced training camp pod Foundation
- Backtracking method to solve batch job scheduling problem
- Detailed explanation of string function and string function with unlimited length
- Puppet automatic operation and maintenance troubleshooting cases
- App移动端测试【3】ADB命令
- QT use qzxing to generate QR code
- VC下Unicode和ANSI互转,CStringW和std::string互转
猜你喜欢

Microservice sentinel flow control degradation

How idea starts run dashboard

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

CString getbuffer and releasebuffer instructions

Popular understanding of gradient descent

Visual host system design and development (Halcon WinForm)

GCC cannot find the library file after specifying the link library path

Semi supervised learning

详解指针进阶2

How are integer and floating-point types stored in memory
随机推荐
nifi从入门到实战(保姆级教程)——flow
Seckill system 2 redis solves the problem of distributed session
App移动端测试【3】ADB命令
WinDbg分析dump文件
驱动与应用程序通信
详解指针进阶2
Visual host system design and development (Halcon WinForm)
Microservice - Nacos registration center and configuration center
Detailed pointer advanced 2
Popular understanding of decision tree ID3
Popular understanding of ovo and ovr
Concurrency-02-visibility, atomicity, orderliness, volatile, CAS, atomic class, unsafe
Jvm-09 byte code introduction
从 flask 服务端代码自动生成客户端代码 -- flask-native-stubs 库介绍
qt使用QZxing生成二维码
Microservice - fuse hystrix
App移动端测试【5】文件的写入、读取
Characteristics of MySQL InnoDB storage engine -- Analysis of row lock
Microservice API gateway zuul
Detailed explanation of string function and string function with unlimited length