๋ฐ์ํ
Go์ if ๋ฌธ์ for ๋ฐ๋ณต๋ฌธ๊ณผ ๋น์ทํ๋ค.
ํํ์ ( ) ๊ดํธ๋ก ๋๋ฌ์์ผ ํ์๋ ์์ง๋ง, { } ๊ดํธ๋ ํ์์ด๋ค.
์์
func sqrt(x float64) string {
if x < 0 {
return sqrt(-x) + "i"
}
return fmt.Sprint(math.Sqrt(x))
}
[์ฐธ๊ณ ์ฌ์ดํธ - a Tour of Go]
๋ฐ์ํ
'Data Base > Go' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Golang] defer (0) | 2021.11.01 |
---|---|
[Golang] Switch (0) | 2021.11.01 |
[Golang] C์ while = Go์ for (0) | 2021.11.01 |
[Golang] for ๋ฐ๋ณต๋ฌธ (0) | 2021.11.01 |
[Golang] Zero values , Nil slices (0) | 2021.11.01 |
๋๊ธ