Hi -- On Sun, 8 May 2005, Adelle Hartley wrote: > Hi all, > > I have been using eval to execute code fragments that I fetch from a > database. (shudder :-) But I'm sure you've heard all of that already :-) > Imagine my surprise when I discovered that the following does not work when > executed by eval: > > unless thing.nil? > puts "I have something" > else > puts "nothing here" > end > > This works as expected when executed "properly" (from within a regular > normal .rb file). > > I don't seem able to make any conditional code work correctly with eval, > unless the conditinoal branch is a one liner: > > puts "I have something" unless thing.nil? > > Are the limitations of eval documented somewhere (or is it possible that I'm > just not doing it right)? I can't duplicate the problem: $ ruby thing = 1 eval ' unless thing.nil? puts "I have something" else puts "nothing here" end' ^D I have something David -- David A. Black dblack / wobblini.net