From: Matt Beckley Date: 2009-11-01T03:30:19+09:00 Subject: Alphabetical selection from array and element updating Writing a crud program where a person would add, delete, update a element (Create, Read, Update, Delete). I have 'add' and 'delete' figured out. Having trouble with methods for updating a element and picking out elements of a particular letter such as a person selecting "a" and the method would produce elements in the array such as Arthur, Andy, and Aimee. Here's the cruddy code (pun intended) ******************************************************************************** names = [] ages = [] hotkey = gets.to_i while hotkey != 10 if hotkey == 3 then puts 'You have selected to update names by their position in the list' puts names puts ages puts 'From top to bottom, type the record number of which age you wish to adjust' element_number = gets.to_i # gets user input from which record is selected ages.index(element_number-1) # select record # Heres where problems start I need to put a element as a integer back in to array and then view array I have tried ages.replace but no luck. Any suggestions? puts names puts ages puts 'Would you like to update another name press 10 for no, press 3 for yes' hotkey = gets.to_i end end puts 'You have quit' print names puts ages ******************************************************************************** The other problem is viewing people by the first letter of the element in the array case insentsitive. Same code as above here is the if loop I am working on with method problems. if hotkey == 5 puts 'Type the first letter of the name you wish to view' puts names a = gets.to_s names.find_all { having trouble passing a from the .gets to this block where a would be the letter value of user input. all names with the letter a would be displayed for viewing } puts names puts 'Would you like to choose another menu option press 10 for no, press 1,2,3 for yes' hotkey = gets.to_i end Thanks again for the help, Matt -- Posted via http://www.ruby-forum.com/.