Check out example codes for "ruby check if exists". It will help you in understanding the concepts better.

Code Example 1

apple = 1

defined?(apple)
# "local-variable"

defined?(bacon)
# nil

Learn ReactJs, React Native from akashmittal.com