From: Sean O'Dell Date: 2004-07-03T03:04:33+09:00 Subject: Re: How to detect if variable has been defined yet? On Friday 02 July 2004 10:49, Randy Lawrence wrote: > Hi, > > I'd like to detect if a variable has been defined yet. Is this possible > in Ruby or mod_ruby? > > For example, I'd like to do the following: > > if $total.exists > $total = $total + 1 > else > $total = 0 > end if defined?($total) $total = $total + 1 else $total = 0 end Sean O'Dell