Function Reference 를 통해서 알아야할 것 : 함수타입 변수를 사용하면 이미 선언되어있는 함수나 객체의 멤버 함수를 가르켜서 사용할수있다.

나는 개인적으로 코드에 나에게 익숙하지않은 부호(예를 들면 this@outer 혹은, Class()::outer 등)가 나오면 일단 일시정지가 되버리는 뇌와 마주할수밖에 없다.. 하지만 어려워할 필요가 없다.


fun main(args: Array<String>) {
    val integerVal : Int//declare a value with an Integer Type as return type
    val functionLiteral : (Int) -> Unit // decalre a value with a Function Type as return type
    //정수의 리턴값을 가진것처럼 함수 타입 리턴값을 가진 변수를 선언했다.
    functionLiteral = { integer -> println("funnctionInside$integer")}
    
    val anonynomousFun:(Int) -> Unit = fun(integer:Int):Unit
    {
        println("functionInside$integer")    
    }  
}
0