From: 7stud -- Date: 2008-02-18T08:46:19+09:00 Subject: Re: displaying user inputed arrays Isaac Toothyxdip wrote: > Im going to try the first solution because i seems like that would work. > But first im going to give a detailed explanation for what im trying to > do. > > In the the terminal (im on mac) it askes the user to enter 5 words on > the same line > > blah-macbook:~ blahblah$ ruby whatever.rb (before running) > (running program) > Please enter 5 words on the same line with spaces then press enter: > Bobo Momo Hoho Lolo Jojo > The five words you entered were: Bobo, Momo, Hoho, Lolo, Jojo > blah-macbook:~ blahblah$ (program finished) > > but i want it to be in array forum and i think that the first reply > might work so i will try that and get back to you puts 'Please enter 5 words on the same line with spaces then press enter:' input = gets.chomp.split p input print 'The five words you entered were: ' puts input.join(' ') --output:-- Please enter 5 words on the same line with spaces then press enter: tom dick mo larry curly ["tom", "dick", "mo", "larry", "curly"] The five words you entered were: tom dick mo larry curly -- Posted via http://www.ruby-forum.com/.