Kotlin | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Kotlin

My answer was correct yet didn't work

6th May 2021, 11:30 AM
Isaac Dickson Dickson
Isaac Dickson Dickson - avatar
4 Answers
+ 6
//try this fun main(args: Array<String>) { var hour = readLine()!!.toInt() if(hour <= 18){ println("Open") } else if(hour <=24) {println("Closed") } }
6th May 2021, 1:29 PM
Simba
Simba - avatar
+ 2
Simba I got it . I forgot that the answers "Open and Close" were case-sensitive . Thanks for drawing my attention 🙂☺️
6th May 2021, 1:34 PM
Isaac Dickson Dickson
Isaac Dickson Dickson - avatar
+ 1
fun main(args: Array<String>) { var hour = readLine()!!.toInt() if(hour <= 18){ println("open") } else if(hour <=24) {println("closed") } else {print("hour must be between 0 and 24")} }
6th May 2021, 11:30 AM
Isaac Dickson Dickson
Isaac Dickson Dickson - avatar
+ 1
//efficient fun main(args: Array<String>) { var hour = readLine()!!.toInt() if(hour <= 18){ println("open") } else if(hour > 18 && hour <=24){ println("closed") } else { print("hour must be between 0 and 24") } }
28th May 2023, 5:46 AM
Carlos