True captain

Report a typo

“The problem is not the problem. The problem is your attitude about the problem. Do you understand?” – Jack Sparrow

This code prints the name of the current captain of the ship (now, it is Hector's name).

However, the crew elected a new captain, and now it's Jack Sparrow.

Fix the declaration of the captain variable, create a new Pirate object with Jack Sparrow's name, assign a new value to the variable captain, and print the name of the current captain again.

Sample Input 1:

Sample Output 1:

Hector Barbossa
Jack Sparrow
Write a program in Kotlin
// you do not need to understand how it works, ignore it
data class Pirate(val name: String)

// Do not touch the lines above

fun main() {
// fix the declaration below
val captain = Pirate("Hector Barbossa")
println(captain.name)
// put your code here


}
___

Create a free account to access the full topic