Hacker News new | ask | show | jobs
by rnentjes 1731 days ago
Alternative way to count the vowels in Kotlin:

    val numVowels = countVowels(getDTO()?.string ?: "")
1 comments

Or alternatively, closer to the original, doing both null checks the same way the original does the first one:

  val numVowels = getDTO()?.string?.let(::countVowels) ?: 0