Bug in a Kotlin Challenge | Sololearn: Learn to code for FREE!


Bug in a Kotlin Challenge

Something weird happening in a Kotlin Pro challenge. Chapter "Control Flow", section "For Loops" The challenge statement is in the following: ====================================================== Vertical Text You need to make a string as input and output it vertically, each letter on a new line. . Sample Input: hello . Sample Output: h e l l o Use a for loop to iterate over the letters of the string. ============================================================ If you just print the input horizontally, it already congratulates you as if you have solved the problem I think the supposed solution would be: ----------------------------------------------------------------------------------------- fun main(args: Array) { var a = readLine() for(i in a){ println(i) } } -------------------------------- But the code doesn't run!

4/3/2021 5:55:25 PM

Lucas Amonati Khing Kliemczak

3 Answers

New Answer


Lucas Kliemczak Yes I already reported this but didn't get any response. To complete this task just print input value println(a)


Write code for this question is :- fun main(args:Array<String>) { val a = readLine() if (a != null) { for (x in a) { println(x) } } }


Report to sololearn by [email protected] or use the in-app bug report for suggestion.