Reputation: 35
I am fairly new to kotlin and below is my code. The result I am expecting should be "Hello Kotlin" but I keep getting an error and am not sure why.
fun sayHello(itemtogreet:String){
val msg = "Hello" + itemtogreet
println(msg)
}
fun main(){
sayHello(itemtogreet:"Kotlin")
}
Upvotes: 1
Views: 175
Reputation: 11
This is also occered to me,But the reason is Kotlin.kt calling Java.class. Wrong writing:
MigrationHelper.updateTableColumn(db, UserDao.class)
Right writing:
MigrationHelper.updateTableColumn(db = db, daoClass = UserDao::class.java)
Upvotes: 0
Reputation: 1
fun sayHello(itemtogreet:String){
val msg = "Hello" + itemtogreet;
println(msg)
}
fun main(){
sayHello(" Kotlin")
}
Upvotes: -1
Reputation: 8723
It's a syntax problem, you have two options:
fun sayHello(itemtogreet:String){
val msg = "Hello" + itemtogreet
println(msg)
}
fun main(){
sayHello("Kotlin")
}
fun sayHello(itemtogreet:String){
val msg = "Hello" + itemtogreet
println(msg)
}
fun main(){
sayHello(itemtogreet = "Kotlin")
}
Upvotes: 2