kotlin 기본 매개 변수

800 단어 kotlin
//    
//       
//           
//                     
//         ,        
//*Array      Array                            
//                                           
fun main(vararg args:String){
    for (arg in args){
        println(arg)
    }
    //hello(1,2,3,4,"7")//         
    hello(1,2,3,4,string = "1212")//      
    hell1o(3.0,1,2,3,4,string = "12")
    val array = intArrayOf(1,2,3,4)
    hello(*array,string = "1212")//*array            Array    list
    hell1o(3.0,*array,string = "12")
    heelo()//         
}
fun hello(vararg ints : Int,string:String){
    ints.forEach(::println)
}
fun hell1o(double:Double,vararg ints : Int,string:String){
    ints.forEach(::println)
}

fun heelo(double :Double = 3.0){
    
}

좋은 웹페이지 즐겨찾기