1.

Solve : Re: For my fellow newbies?

Answer»

Hi , rain or anyone ELSE that would care to answer , I'm learning Ruby  myself and having trouble with creating a program , the program must alphabetize any word typed and do a gets.chomp kinda thing. Thats the problem i cant get the hang of arays I'm trying to create the program so it takes the as many words as a person WANTS to TYPE and after presing enter  and SORTS it alphabetically then when the enter button  it sorts the word and if enter is pressed with out a word then  the output is printed as a alphabetized list on the screen . if this is the wrong place to post this , im sorry . as far as i can figure it would look sorta like this .


puts 'please type a word'
word = gets.chomp
while word = sort
   word == TRUE
   nil = false
   if false == puts
    end
i know this is wrong thats why im here what would it look like if i used arays in this ? and how do i use the sort comand does the Ruby language just automaticaly sort the strings  alphabetized ?
Owell anyhelp would be apreaciated , thank you in advance.



Discussion

No Comment Found