TIL: Ruby stuff II

Continuing adventures in The Ruby Programming Language

I see you

Ruby doesn't like when you use variables or methods that aren't defined:

Ruby ❯ irb
irb(main):001:0> a 
NameError: undefined local variable or method `a' for main:Object  
  from (irb):2  
  from /Users/clint/.rbenv/versions/1.9.3-dev/bin/irb:12:in `<main>'

Makes sense – a doesn't exist. However, if the interpreter has at
least seen a, things will be different:

Ruby ❯ irb
irb(main):003:0> if false
irb(main):004:1> a = true
irb(main):005:1> end
=> nil
irb(main):006:0> a
=> nil

Above, a is never assigned, but it's still seen by the interpreter, so
it still exists in some way.

@ctshryock

About

My name is Clint Shryock. I develop things in Go and Ruby. I live in central Missouri, where the weather is beautiful 4 months of the year.
+-----------------+
|                       |
|      (ノ^_^)ノ      |
|                       |
|   ☜(゚ヮ゚☜)    |
|                       |
|     ౿(ఠ_ఠఎ)    |
|                       |
|        ಠ_ಠ         |
x                      x
  xxx           xxx
       xx    xx
           xx