From: Gregory Brown Date: 2009-10-23T00:37:28+09:00 Subject: Re: convert/replace a value of nil with 0? On Thu, Oct 22, 2009 at 11:24 AM, Mmcolli00 Mom wrote: > Do you know how I can convert or replace any value that gets back a > 'nil' to 0? > > For instance, the myArrayVal[0] may or may not contain a number and I > want the code to default to 0 if a nil is returned. I have not found any > documentation on this. >> nil.to_i => 0 >> nil.to_f => 0.0