WHY ISN'T THIS WORKING! Unresolved refrence

fun sayHello(itemToGreet:String) {
val msg = "Hello " + itemToGreet

fun main() {

The second part where fun main where itemToGreet is written gives unresolved refrence

named arguments use = instead of : in kotlin. Also the proper way to combine strings is "Hello$itemToGreet".
Also it would be nice if you could format the code properly and don’t use caps lock in the title. That way people are far more likely to help you.

1 Like

Thank you bro, but I figured it out. All I had to do was to delete itemTogreet instead of writing it. I sat an hour thinking why this doesnt work and a friend told me why. Im pretty emberrased of myself.

Lol don’t sweat it. In Kotlin (unlike Swift), parameter names are nearly always optional, and like @Wasabi375 said, you use =, and not : like Swift :slight_smile: