From: Matthew Borgeson Date: 2007-07-18T20:05:14+09:00 Subject: Newbie looking for help: Determining Gender Hey All- I just started attempting to program in Ruby a month ago, but have reached an impasse. I am writing a dosing program and am trying to do something very simple: Have a user enter either m for a male or f for a female so that info can be taken to the next equation to be used for something else. I originally wrote it as follows: #Introduction puts 'Hello. Welcome to the Aminoglycoside Dosing Calculator.' # Determines the patient dosing gender puts 'What gender is your patient? Please enter m or f' ptSexS = gets.chomp.downcase if ptSexS == 'f' doseSexS = 'female' elsif ptSexS == 'm' doseSexS = 'male' end puts 'Your patient is a ' + doseSexS The problem here is I have written all of the mathematical operations I need in blocks like this, but I dont know how to make them accomodate for invalid answers. For instance, if the user enters an m or an f above, I have the doseSexS determined for the next part of the program. If the user enters something else, I want it to ay "please try again' and start over.. I have tried while loops but cant get it to work as well as making it into a method. Is there a different way to do this that my lack of experience is preventingme from seeing/ Is iteration over a an array something worth following? I apologize for such a basic question, but the PickAxe,the book by Chris Pine, and multiple web sites are failing me and I am turnig here as a last resort... Thanks in advance for any help Matthew F Borgeson