๐ŸŒฟ ํ•จ์ˆ˜: print

3674 ๋‹จ์–ด printswiftforfuncfor

ํ•จ์ˆ˜ ๊ตฌ์„ฑ

func ํ•จ์ˆ˜์ด๋ฆ„ (๋งค๊ฐœ๋ณ€์ˆ˜: data type) -> ๋ฐ˜ํ™˜๊ฐ’{
	์›ํ•˜๋Š” ํ•จ์ˆ˜ ๊ธฐ๋Šฅ
	}

print ํ•จ์ˆ˜

print(1, 2, 3) 
1 2 3

print(1, 2, 3, seperator: "!")
1!2!3

print(1, 2, 3, separator: "")
123

print("์€์€ํ•œ :")
print("์€ํ•œ")
์€์€ํ•œ :
์€ํ•œ

print("์€์€ํ•œ", terminator: ":")
print("์€ํ•œ")
์€์€ํ•œ : ์€ํ•œ

๋ฐ˜๋ณต๋ฌธ

func printGugudan(dan: Int) {
    for time in 1...9 {
        print("\(dan) * \(time) = \(dan * time)")
    }
}

printGugudan(dan:2)

์ถœ๋ ฅ
2 * 1 = 2
2 * 2 = 4
2 * 3 = 6
2 * 4 = 8
2 * 5 = 10
2 * 6 = 12
2 * 7 = 14
2 * 8 = 16
2 * 9 = 18

์ข‹์€ ์›นํŽ˜์ด์ง€ ์ฆ๊ฒจ์ฐพ๊ธฐ