<Iterator - next() - loop run uncompleted> Why mis...
# forum
r
Iterator - next() - loop run uncompleted Why miss does the last loop with the input “150 144 220 170”? result: You can go! Sorry, not today You can go! fun checkHeight(iterator: Iterator) { while (iterator.hasNext()) { if(iterator.next() < 145 || iterator.next() > 210) { println("You can go!") } else { println("Sorry, not today") } } } fun main() { val list = readln().split(" ").map(Integer::parseInt).toList() checkHeight(list.iterator()) } 1 post - 1...