์ง๊ด์ ์์๋ณ์ ์ฌ์ฉ (Introduce Explaining Variable)
์ง๊ด์ ์์๋ณ์ ์ฌ์ฉ (Introduce Explaining Variable)์ ์์๋ณ์๋ฅผ ์ฌ์ฉํ์ฌ ๋ณต์กํ ์์ด๋ ๊ณ์ฐ ๊ฒฐ๊ณผ๋ฅผ ์ ์ฅํ๊ณ , ์ด๋ฅผ ์ดํดํ๊ธฐ ์ฌ์ด ์ด๋ฆ์ผ๋ก ๋ช
๋ช
ํ์ฌ ๊ฐ๋
์ฑ์ ๋์ด๋ ๋ฆฌํฉํ ๋ง ๊ธฐ๋ฒ์
๋๋ค. ์๋ฅผ ๋ค์ด, ๋ค์๊ณผ ๊ฐ์ ์ฝ๋๊ฐ ์๋ค๊ณ ๊ฐ์ ํด๋ณด๊ฒ ์ต๋๋ค. func calculateTotalPrice(price: Double, count: Int) -> Double { var totalPrice = price * Double(count) if count > 10 { totalPrice *= 0.9 } return totalPrice } ์ ์ฝ๋์์ totalPrice๋ price์ count๋ฅผ ์ฌ์ฉํ์ฌ ๊ณ์ฐ๋๋ฏ๋ก, ์ด๋ฅผ ์ดํดํ๊ธฐ ์ด๋ ค์ธ ์ ์์ต๋๋ค. ์ด๋ฅผ ์ง๊ด์ ์ธ ์์๋ณ์๋ฅผ ์ฌ์ฉํ์ฌ ๊ฐ๋
์ฑ์..