Mega Code Archive

 
Categories / Ruby / Statement
 

While loop with array length

a = [1, "test", 2, 3, 4] i = 0 while (i < a.length)   puts a[i].to_s + "X"   i += 1 end