Over a million developers have joined DZone.

Just Rescue If The Errors Cause Doesn't Matter

Sometimes we have to check for every possible error and react adequate, but only sometimes. 
There are also cases, where it does not matter what's wrong,
the result we want in any error case is clear.
Then we  can just rescue.
Here the occurrence array may not be set because nothing is counted yet,
or one element is not set, because the according letter didn't occur yet,
it does not matter. We always answer "The requested letter occurred 0 times till now." 

  def get_char_count(letterbyte)

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}