Every class has a nil?
method:
if a_variable.nil?
# the variable has a nil value
end
And strings have the empty?
method:
if a_string.empty?
# the string is empty
}
Remember that a string does not equal nil
when it is empty, so use the empty?
method to check if a string is empty.