arr = ["samsung,","htc,","general-mobile","lg,","iphone,"] i=0temp = []while(i<arr.length)temp << arr[i].chop.size if arr[i].include? ','i += 1end p temp
Standard input is empty
[7, 3, 2, 6]
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!