Merge pull request #432 from patimen/main

Switch to readln
This commit is contained in:
Jeff Atwood
2022-01-06 09:27:23 -08:00
committed by GitHub
+2 -2
View File
@@ -37,14 +37,14 @@ fun main() {
// an answer or a blank string
fun ask(question: String): String {
print("$question? ")
return readLine()?.uppercase() ?: ""
return readln().uppercase() ?: ""
}
// Special case for a "yes or no" question, returns true of yes
fun askYesOrNo(question: String): Boolean {
return generateSequence {
print("$question? ")
readLine()
readln()
}.firstNotNullOf { yesOrNo(it) }
}