defined? expression tests whether or not expression refers to anything recognizable (literal object, local variable that has been initialized, method name visible from the current scope, etc.). The return value is nil if the expression cannot be resolved. Otherwise, the return value provides information about the expression.
Note that the expression is not executed.
p defined?(def x; end) # "expression"
x # error: undefined method or variable
p defined?(@x=1) # "assignment"
p @x # nil
Assignment to a local variable will, however, have the usually result of initializing the variable to nil by virtue of the assignment expression itself:
p defined?(x=1) # assignment
p x # nil
In most cases, the argument to defined? will be a single identifier: