(1) If I do this:

  x = '' if not defined?(x)
  p x

Then I get this:

  nil

(2) But if I do this:

  if not defined?(x) then x = '' end

Then I get this:

  ""

(3) But, if I do this:

  x = '' if not defined?(x)
  if not defined?(x) then x = '' end
  p x

Then I get this:

  nil

What's going on here?