Kotlinlearncs.online LogoJava
Return to List

Solve: Greet by Name

Created By: Geoffrey Challen
/ Version: 2026.8.0

Printing gets a lot more useful once you can mix text that you wrote with values that your program is holding. When one side of + is a String, Kotlin joins the two together into a longer String, and you can print the result.

Assuming a String variable named name has been declared and initialized, write a snippet of code—not a function—that greets that person by name on a single line. So if name were "Alex", you would print:

Hello, Alex!

Don't modify name.

Related Lessons

Stuck? You may find these lessons helpful:

Report a Problem

Attribution must link to this page: https://www.learncs.online/solve/kotlin/greet-by-name/[email protected]