0

Why my output is incerect

My output is the same is the expected output so why my output is incerect . This is my code :class MusicPlayer { private var songs: Array<String> = arrayOf() //your code goes here fun add(valu: String ){ songs += valu } fun show(){ for (x in songs ){ println(x) } } fun play (){ println ("playng " + songs[0] ) } } fun main(args: Array<String>) { val m = MusicPlayer() while(true) { var input = readLine()!! if(input == "stop") { break } m.add(input) } m.show() m.play() }

21st Nov 2021, 9:02 AM
yoel
1 Odpowiedź
+ 5
Have a look at the spelling: fun play(){ println("Playing "+songs[0]) Upper case "P" and a missing "i" in "Playing"
21st Nov 2021, 10:30 AM
Coding Cat
Coding Cat - avatar