Menu
Coddy logo textTech

Recap - Validation Function

Part of the Fundamentals section of Coddy's Kotlin journey. Lesson 62 of 93.

challenge icon

Challenge

Medium

Write a function isValidUsername that takes username and returns whether it meets the validation requirements.

A valid username must satisfy all of the following conditions:

  • At least 3 characters long
  • No more than 15 characters long

Parameters:

  • username (String): The username to validate

Returns: true if the username is valid, false otherwise (Boolean)

Try it yourself

fun isValidUsername(username: String): Boolean {
    // Write code here
}

All lessons in Fundamentals

Practice on your own: Kotlin playground