From: tamouse mailing lists Date: 2013-03-16T02:06:52+09:00 Subject: Re: Retrieves the count for the list of entries - not working On Fri, Mar 15, 2013 at 11:04 AM, Syed H. wrote: > def get_entry_count(type) > controls = (type.nil?)? nil : get_list_entries_container(type) > retVal = 0 > unless (controls.nil?) > retVal = controls.length > else > retVal = puts "Unable to find list entries for table of: > #{type}" > end > return retVal > end Aslo, Syed, I hope you don't mind, I'd like to offer something a little cleaner? You can surely reject this if you want.. You may not like early returns, which it seems your code is going out of it's way to avoid. I think they make clearer code in some cases. def get_entry_count(type) return if type.nil? # you /might/ consider raising an exception if this isn't supposed to happen? controls = get_list_entries_container(type) return controls.cells.count unless controls.nil? puts "Unable to find list entries for table of type #{type}" 0 end