# Re: setting nil to zero

**URL:** <https://www.ruby-forum.com/t/re-setting-nil-to-zero/72173>\
**Category:** Ruby\
**Created:** [February 23, 2006, 4:48am UTC](https://www.ruby-forum.com/t/re-setting-nil-to-zero/72173 "2006-02-23T04:48:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![PeSSSSaS\_Botp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ecd19e/32.png) [@PeSSSSaS\_Botp](https://www.ruby-forum.com/u/PeSSSSaS_Botp)\
**Post date:** [February 23, 2006, 4:48am UTC](https://www.ruby-forum.com/t/re-setting-nil-to-zero/72173/1 "2006-02-23T04:48:05Z")

</div>

Logan C. [[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] :

# f[w] = f[w].to\_i + 1

i felt like being the dumbest guy on earth .  
this one works for both arrays and hashes.  
thank you for the uber cool tip, ruby hacker logan (though i have to  
squinch my eyes a bit for that quick hack 🙂

thanks to all too and kind regards -botp
