๐Ÿ“ฑ App Development Study/iOS๐ŸŽ

[Udemy iOS & Swift Bootcamp] Internal and External Parameter Names

ibelieveinme 2023. 5. 13. 01:40
728x90

swift ํ•จ์ˆ˜์—์„œ ์•„๋ž˜์ฒ˜๋Ÿผ external, internal ํŒŒ๋ผ๋ฏธํ„ฐ๋ฅผ ์ง€์ •ํ•  ์ˆ˜ ์žˆ๋‹ค.

func myFunc(External Internal: Type){
	print(Internal)
}

myFunc(External: value)

 

๊ทธ๋ฆฌ๊ณ  ๋‹ค๋ฅธ ๋ถ€๋ถ„์—์„œ myFunc ํ•จ์ˆ˜๋ฅผ ํ˜ธ์ถœํ•  ๋•, External ๋ณ€์ˆ˜์— ์–ด๋–ค ๊ฐ’์„ ๋„ฃ์–ด์•ผ ํ•˜๋Š”์ง€ ์œ„์ฒ˜๋Ÿผ ์ •ํ™•ํ•˜๊ฒŒ ๋ช…์‹œํ•ด์•ผ ํ•œ๋‹ค.

 

์ด ๋•Œ, ์•„๋ž˜์ฒ˜๋Ÿผ _ ํ‚ค์›Œ๋“œ๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค๋ฉด External ๋ณ€์ˆ˜๋ช…์„ ์•ˆ์ ์–ด๋„ ๋œ๋‹ค.

func myFunc(_ Internal: Type){
	print(Internal)
}

myFunc(value)

์‚ด์ง ํ—ท๊ฐˆ๋ฆฌ์ง€๋งŒ ๊ธฐ์–ตํ•ด๋‘์ž!

728x90