Sha256: ab5dee0a060bea7cf094fab4c054383c3828ca0cad7d47a35cd9a1d4ed945d8c
Contents?: true
Size: 648 Bytes
Versions: 270
Compression:
Stored size: 648 Bytes
Contents
/** * Bob is a lackadasical teenager. */ object Bob { fun hey(input: String): String { return when { isSilence(input) -> "Fine. Be that way!" isShout(input) -> "Whoa, chill out!" isQuestion(input) -> "Sure." else -> "Whatever." } } private fun isSilence(input: String) = input.isBlank() private fun isQuestion(input: String) = input.endsWith("?") private fun isShout(input: String): Boolean { val isOnlyUppercase = input == input.toUpperCase() val hasLetter = input.contains(Regex("[A-Z]")) return hasLetter && isOnlyUppercase } }
Version data entries
270 entries across 270 versions & 1 rubygems