w3resource

Kotlin program: Find out your Kotlin version

Kotlin Basic: Exercise-2 with Solution

Write a Kotlin program to find out what version of Kotlin you are using.

Sample Solution:

Kotlin Code:

fun main() {
    val kotlinVersion = KotlinVersion.CURRENT
    println("Kotlin Version: ${kotlinVersion}")
}

Sample Output:

Kotlin Version: 1.8.21

Note:

When you run this program, it will output the version of Kotlin you are using, such as:
Kotlin Version: 1.5.30

The actual version number may vary depending on your Kotlin installation.

Kotlin Editor:


Previous: Print 'Hello' and name on separate lines.
Next: Display current date and time.

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/kotlin-exercises/basic/kotlin-basic-exercise-2.php