From: 7stud -- Date: 2007-11-26T05:42:46+09:00 Subject: Re: entering nil string value through gets Nathan Viswa wrote: > > democrats.each { |i| print i, " "} if party == "democrats" > puts 'x5' > republicans.each { |i| print i, " "} if party == "republicans" > puts 'x6' > print "All presidents since 1976 were either Democrats or > Republicans\n"\ > if (party != "democrats" && party != "republicans") > end By the way, constructs like the above require that ruby evaluate all three of the conditionals, where with a construct like: if party == 'democrats' puts 'dems' elsif party == 'republicans' puts 'rep' else puts "All presidents..." end as soon as one if-conditional is found to be true, the others below it are not evaluated. Also notice that no complex conditional has to be used for the else clause. The ruby syntax where an if conditional comes at the end of a statement is a particularly horrid one. I suggest you avoid it completely. -- Posted via http://www.ruby-forum.com/.