Help with Kotlin 22.2 practice | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Help with Kotlin 22.2 practice

I’m having difficulties with this code challenge. Can anyone help please and thank you You are given code that should iterate through an array and output the first letters of each element. However, the code has errors. Fix the code to result in the expected output. //. My code here https://sololearn.com/coach/1137/?ref=app

28th Sep 2022, 3:01 PM
Brent Tyson
Brent Tyson - avatar
2 Answers
+ 3
fun main(args: Array<String>) { var arr = arrayOf("James", "Amy", "Sam", "Olie", "Bob") arr.forEach() { item -> print(item[0]) } }
28th Sep 2022, 3:22 PM
SoloProg
SoloProg - avatar
+ 1
SoloProg thank you!!! Much appreciated
28th Sep 2022, 11:51 PM
Brent Tyson
Brent Tyson - avatar