go언어(3)
-
[Go/Golang] Go 언어 조건문 (switch)
이번에는 switch문이다. https://gobyexample.com/switch Go by Example: Switch Switch statements express conditionals across many branches. package main import ( "fmt" "time" ) func main() { Here’s a basic switch. i := 2 fmt.Print("Write ", i, " as ") switch i { case 1: fmt.Println("one") case 2: fmt.Println("two") case 3: fmt.Prin gobyexample.com 이번 예제의 코드는 아래와 같다. package main import ( "fmt" "time" ) fu..
2022.06.10 -
[Go/Golang] Go언어 조건문 (if/else)
이제 조건문이다 조건문에는 if/else랑 switch가 있다 https://gobyexample.com/if-else Go by Example: If/Else Branching with if and else in Go is straight-forward. package main import "fmt" func main() { Here’s a basic example. if 7%2 == 0 { fmt.Println("7 is even") } else { fmt.Println("7 is odd") } You can have an if statement without an else. if 8%4 == 0 { fm gobyexample.com 먼저 if/else 부터보면 package main import "..
2022.06.09 -
[Go/Golang] Go 언어 반복문
이제 반복문 차례이다 https://gobyexample.com/for Go by Example: For for is Go’s only looping construct. Here are some basic types of for loops. package main import "fmt" func main() { The most basic type, with a single condition. i := 1 for i
2022.06.08