0
0
Kotlinprogramming~10 mins

Print and println output in Kotlin - Mini Project: Build & Apply

Choose your learning style9 modes available
Print and println output
📖 Scenario: You are learning how to show messages on the screen using Kotlin. This is like writing notes on a paper to share with friends.
🎯 Goal: You will write Kotlin code to print messages using print and println functions and see how they behave differently.
📋 What You'll Learn
Create a variable with a message
Use print to show the message without moving to a new line
Use println to show the message and move to a new line
Print multiple messages to observe the difference
💡 Why This Matters
🌍 Real World
Printing messages is the first step to communicate with users in programs, like showing instructions or results.
💼 Career
Understanding how to display output is essential for debugging and user interaction in software development.
Progress0 / 4 steps
1
Create a message variable
Create a variable called message and set it to the text "Hello, Kotlin!"
Kotlin
Need a hint?

Use val to create a variable that does not change.

2
Print the message using print
Use print(message) to show the message without moving to a new line
Kotlin
Need a hint?

print shows text but stays on the same line.

3
Print the message using println
Use println(message) to show the message and move to a new line
Kotlin
Need a hint?

println shows text and moves to the next line.

4
Print multiple messages to compare
Print print(message) followed by println(message) and then println("Done") to see how lines change
Kotlin
Need a hint?

Observe how print and println affect the output lines.