From: Nathan Viswa Date: 2007-11-26T02:18:27+09:00 Subject: entering nil string value through gets when i enter nil for gets, it is not comparing with another string having nil value. tried gets.chomp which also gives the same problem. any help? democrats = ["Carter", "Clinton"] puts 'x1' republicans = ["Ford", "Reagan", "Bush1", "Bush2"] puts 'x2' puts "Enter nil or democrats or republicans or any for party =" #party = gets # without chomp all comparison fails. #puts party #party = gets.chomp # nil fails #puts party #party1 = gets # #party = party1.chomp # nil fails #puts party, party1 #party.chomp = gets # err. undefined var or method party #puts party #party1 = gets # #party.chomp = party1 # err. undefined var or method party #puts party, party1 if party != nil 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 -- Posted via http://www.ruby-forum.com/.