From: Gregory Brown Date: 2005-11-17T13:53:23+09:00 Subject: Re: Improving code... On 11/16/05, Joe Van Dyk wrote: > def cpu_percentage > # if we don't know the previous time, return 0.0 > if @previous_cpu_time.nil? || @previous_time.nil? > @previous_cpu_time = get_process_cpu_time > @previous_time = Time.now @previus_cpu_time ||= get_process_cpu_time @previous_time ||= Time.now That drops the conditional.