+ 1
Why don't all the quantities add up and come out separately?
fun main(args: Array<String>) { var arr = arrayOf(1, 3, 5) var x=0 arr.forEach { x+= it *4 println(x) }
3 Answers
+ 4
put println(x) outside after loop..
+ 2
Thanks š
+ 1
I want the 3 quantities to be added at the end