Better HN
topnewbestaskshowjobs
Log inSign up

chief

1 karma · joined Nov 16, 2009 (17y ago) · 1 submissions

Submissions

comment 16y ago · link · parent

I think the article is wrong. His rewrite on line 06. should use if instead of unless.

  $ irb
  >> b
  NameError: undefined local variable or method `b' for main:Object
  	from (irb):1
  >> if defined? b
  >>   b = 5
  >> end
  => nil
  >> b
  => nil
  >> defined? b
  => "local-variable"