Hacker News new | ask | show | jobs
by angilly 6015 days ago
No, it's using unless like I intended. But your example also demonstrates the weird behavior. As a few people have pointed out here and over in the post comments, the issue at hand isn't so much about statement modifiers as it is about how Ruby 'defines' local variables.

Take this for example:

  ra:~$ irb
  a = irb(main):001:0> a = b
  NameError: undefined local variable or method `b' for main:Object
  	from (irb):1
  irb(main):002:0> defined? a
  => "local-variable"
  irb(main):003:0> 

It just so happens that using statement modifiers in the way I tried using them brings this behavior to light.