From: "Thomas B." Date: 2008-08-30T08:00:52+09:00 Subject: Re: assignment operator that treats empty and nil as the same thing scooterm@hotmail.com wrote: > I would like to handle this with a *single* assignment operator, just > like you can do in test1. There is no such operator in Ruby. You have to make an if statement or something. Also remember that if the value is nil, calling empty? on it raises an error, so you have to check first for nil? and then for empty?. You can make it a bit easier with something like this: class Object def nothing? if nil? true elsif respond_to? :empty? and empty? true elsif respond_to? :zero? and zero? true else false end end end You won't have to check both conditions now. TPR. -- Posted via http://www.ruby-forum.com/.