当前位置:网站首页>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
边栏推荐
- Using multipleoutputs to output multiple files in MapReduce
- 详解指针进阶2
- Tensorflow realizes verification code recognition (III)
- Popular understanding of linear regression (II)
- Custom annotation
- Concurrency-02-visibility, atomicity, orderliness, volatile, CAS, atomic class, unsafe
- Secsha system 1- login function
- App mobile terminal test [5] file writing and reading
- 求字符串函数和长度不受限制的字符串函数的详解
- Popular understanding of gradient descent
猜你喜欢
几种常见IO模型的原理
Detailed pointer advanced 2
Shell script import and export data
Wechat payment -jsapi: code implementation (payment asynchronous callback, Chinese parameter solution)
Introduction series of software reverse cracking (1) - common configurations and function windows of xdbg32/64
Redis在Windows以及Linux系统下的安装
Seckill system 3- product list and product details
秒杀系统3-商品列表和商品详情
Jvm-05-object, direct memory, string constant pool
Creation and destruction of function stack frames
随机推荐
Visual host system design and development (Halcon WinForm)
[combinatorics] combinatorial identities (recursive combinatorial identities | sum of variable terms | simple combinatorial identities and | sum of variable terms | staggered sums of combinatorial ide
Distributed task scheduling XXL job
潘多拉 IOT 开发板学习(HAL 库)—— 实验5 外部中断实验(学习笔记)
通过进程PID获取可执行文件路径(QueryFullProcessImageName)
Create gradle project
Find mapping relationship
阿特拉斯atlas扭矩枪 USB通讯教程基于MTCOM
Intelij idea efficient skills (III)
Digital image processing -- popular Canny edge detection
Location of software installation information and system services in the registry
Three dimensional reconstruction of deep learning
需要知道的字符串函数
Reading notes of "micro service design" (Part 2)
Microservice API gateway
CString中使用百分号
VS2017通过IP调试驱动(双机调试)
Jvm-09 byte code introduction
Leasing cases of the implementation of the new regulations on the rental of jointly owned houses in Beijing
秒殺系統3-商品列錶和商品詳情