๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
Data Base/Go

[Golang] C์˜ while = Go์˜ for

by ์ฝ”๋”ฉํ•˜๋Š” ๋ถ•์–ด 2021. 11. 1.
๋ฐ˜์‘ํ˜•

; ์„ ์ƒ๋žตํ•  ์ˆ˜ ์žˆ๋‹ค๋Š” ์ ์—์„œ C์˜ while ์€ Go์—์„œ for ๋กœ ์“ฐ์ธ๋‹ค.

 

 

์˜ˆ์ œ

package main

import "fmt"

func main() {
	sum := 1
	for sum < 1000 {
		sum += sum
	}
	fmt.Println(sum)
}

 

 

 

 

[์ฐธ๊ณ  ์‚ฌ์ดํŠธ - a Tour of Go]

๋ฐ˜์‘ํ˜•

'Data Base > Go' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

[Golang] Switch  (0) 2021.11.01
[Golang] if๋ฌธ  (0) 2021.11.01
[Golang] for ๋ฐ˜๋ณต๋ฌธ  (0) 2021.11.01
[Golang] Zero values , Nil slices  (0) 2021.11.01
[์‰ฝ๊ณ  ๋น ๋ฅธ Go ์‹œ์ž‘ํ•˜๊ธฐ] #1.11 Structs  (0) 2021.10.29

๋Œ“๊ธ€