What I’m doing wrong here? Help with while loop. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What I’m doing wrong here? Help with while loop.

Hello. Please, someone can help me? I don’t know what I’m doing wrong. It’s continuous input exercise: fun main(args: Array<String>) { while(true) { var input = readLine()!!.toInt() if (input == 0){ break } println(input) } } https://sololearn.com/coach/1124/?ref=app Thanks!

27th May 2021, 12:10 AM
Isabella Martins
Isabella Martins - avatar
6 Answers
+ 4
I think there is a problem in Sololearn compiler. I tried it and passed all test cases. Maybe it will work later :) https://ibb.co/M7YWJFF
27th May 2021, 2:01 AM
Simba
Simba - avatar
+ 3
https://www.sololearn.com/Discuss/2719241/?ref=app
27th May 2021, 1:16 AM
Simba
Simba - avatar
+ 1
Isabella Martins It is a new SoloLearn bug. Don't know since when it is happening but I experienced it today. When I run codes, it shows "No output". But if I keep running the code over and over again, it finally shows the output. The same is happening with the code coach. Try repeatedly running the code and eventually you will get output and the test cases will pass (passed for me after trying around 5-6 times) (When solving a problem, SoloLearn detects changes in the code and only reruns when there is some change. So you will need to do changes to the code before re-running it. The simplest way is to keep adding a space at the end of the code)
27th May 2021, 6:30 AM
XXX
XXX - avatar
0
Hey Simba, it didn’t work for me :(
27th May 2021, 1:24 AM
Isabella Martins
Isabella Martins - avatar
0
This code? Right? Here we go! https://code.sololearn.com/cVb3jtC4j0hB/?ref=app Not worked here
27th May 2021, 1:55 AM
Isabella Martins
Isabella Martins - avatar
0
Hi
27th May 2021, 6:50 PM
Bashir Ali
Bashir Ali - avatar