ios
(ios) Xcode - Playground에서 함수 사용방법 세번째
SAFE
2016. 4. 15. 11:36
함수속에 함수를 넣어서 사용 가능하다.
지역변수 - 함수안에 선언된 변수
프로그램 종료 시 같이 종료 된다.
//: Playground - noun: a place where people can play
import Cocoa
var str = "Hello, playground"
//=====
func son22(age:Int) -> String{
func num1(baseAge:Int) -> Int{
return baseAge+1
}
let msg=" 나이는 \(num1(20)) "
return msg;
}
son22(1);
//=====
func son23(name:String) -> String{
func num1(baseAge:Int) -> Int{
return baseAge+1
}
let msg=" \(name)님의 한국 나이는 \(num1(20)) "
return msg;
}
son23("KEVIN");