From: ~Kay Byrd~ Date: 2007-03-22T06:03:21+09:00 Subject: Re: Exiting in the middle of the program --------------060306040100090806020406 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Yes, if name == 'exit' exit end will get you an exit, or you can also put '' without the word exit and an empty entry will exit the program as well. code: if name = = ' ' exit end *~Kay~* Helgitomas Gislason wrote: > Errm... That does not tell me what code to put in the program to exit > it... > > Example: > > 1. puts 'Hello there' > 2. puts 'What\'s your name?' > 3. puts ' ' > 4. name = gets.chomp > 5. puts ' ' > 6. > 7. if name == 'John' > 8. puts 'Nice name!' > 9. end > 10. > 11. if name == 'Mary' > 12. puts 'What a beautiful name!' > 13. end > > Now. If I'd like to exit the program without typing the name, just say > "exit", what code should I put? > > Can I only say: > > if name == 'exit' > exit > end > > ? > > > --------------060306040100090806020406--