n=0a=[]a<<(n=gets.to_i) until n==-1for i in 0..a.size-1 puts a[i] unless a[i]==-1end
2 3 4 -1
2 3 4
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!