Beginner Kotlin
Q19 / 100

What is an extension function in Kotlin?

Correct! Well done.

Incorrect.

The correct answer is B) A function that adds new functionality to an existing class without modifying its source code

B

Correct Answer

A function that adds new functionality to an existing class without modifying its source code

Explanation

fun String.shout() = uppercase() + "!" adds a shout() method to String without subclassing or modifying String.

Progress
19/100