Functions With an Implicit Return func greeting(for person: String) -> String { "Hello, " + person + "!" } ์ ์ฒด ๋ณธ๋ฌธ์ด ํ์ค๋ก ํํ์ด ๋๋ค๋ฉด returnํค์๋ ์๋ต ๊ฐ๋ฅ Specifying Argument Labels func greet(person: String, from hometown: String) -> String { return "Hello \\(person)! Glad you could visit from \\(hometown)." } print(greet(person: "Bill", from: "Cupertino")) ํจ์ ๋ด๋ถ์์ ์ฌ์ฉํ ์ธ์ ์ด๋ฆ ์ง์ ์ด ๊ฐ๋ฅํ๋ค. ๊ฐ๋ณ ํ๋ผ๋ฏธํฐ (Variadic Para..
for๋ฌธ์ stride ๋ฉ์๋ for i in stride(from: 0, to: 10, by: 2) { print(i) // 0, 2, 4, 6, 8 } for i in stride(from: 0, through: 10, by: 2) { print(i) // 0, 2, 4, 6, 8, 10 } // reverseํ๊ณ ์ถ์ ๋ ์ธ ์ ์๋ค. for i in stride(from: 3, through: 0, by: -1) { print(i) // 3, 2, 1, 0 } 1์ฉ ์ฆ๊ฐ๊ฐ ์๋ ์ํ๋ ์ซ์๋งํผ ์ฆ๊ฐ ์ํค๊ณ ์ถ์ ๋ ์ฌ์ฉ to : toํ๋ผ๋ฏธํฐ์ ์๋ ์๋ฅผ ์ ์ธํ๋ค. through: throughํ๋ผ๋ฏธํฐ์ ์๋ ์ ํฌํจํ๋ค. repeat while ๊ตฌ๋ฌธ var num = 1 repeat { num +..