Kotlin readline() doesn't work? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Kotlin readline() doesn't work?

Hi i was just writing a small program in kotlin which takes input from user and convert it into string. But i observed it threw an error when i used readline() to take input....any guesses it doesn't work on solo learn?

8th Jul 2019, 12:12 AM
mirza
mirza - avatar
8 Answers
+ 3
Errors without line numbers happen with server miscommunication. Always try multiple times when you get those errors before you assume that it is actual.
8th Jul 2019, 2:44 PM
John Wells
John Wells - avatar
+ 4
What's the code that you're having troubles with?
8th Jul 2019, 12:52 AM
Faisal
Faisal - avatar
+ 4
It does work fine. However, SoloLearn input works differently than elsewhere. The input prompt must receive all of the inputs your program requires. Once done, the inputs & code get loaded on a server and run. After it completes, the outputs are transfer back to display on your device.
8th Jul 2019, 2:28 AM
John Wells
John Wells - avatar
+ 3
readLine is the correct spelling. You are missing an else after line 8 with a no.
8th Jul 2019, 2:33 PM
John Wells
John Wells - avatar
+ 2
Line 6 should be || not &&. You want years not divisible by 100 or divisible by 400.
8th Jul 2019, 2:41 PM
John Wells
John Wells - avatar
+ 1
Sure, thank you
8th Jul 2019, 6:43 PM
mirza
mirza - avatar
8th Jul 2019, 2:30 PM
mirza
mirza - avatar
0
I have capitalized the L in readLine now it is demanding an input but after giving let say "2012" as an input it shows on screen the first print statement which is "enter the year......" and once it also gave me "memory limit exceeds" on entering 2222
8th Jul 2019, 2:42 PM
mirza
mirza - avatar