Kotlinlearncs.online LogoJava
Return to List

Solve: First Two

Imported By: Geoffrey Challen
/ Version: 2021.6.0

Given a String return the String made of its first two chars. So the String "Hello" yields "He". If the string is shorter than length 2, return whatever there is, so "X" yields "X", and the empty string "" yields the empty string "".

fun firstTwo(input: String): String {
return "" // You may need to remove this starter code
}

Related Lessons

Stuck? You may find these lessons helpful: