News for hackers. Stuff that matters.
Re:Ruby statement modifiers behave differently than conditio... by angilly on Monday December 28, 2009 @02:05PM (#1019126)
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.

There are no comments on this comment yet.