On Wednesday, January 29, 2003, 5:04:51 PM, ahoward wrote:

> (IO.readlines (path)).each do |line|
>   export max = 0
>   ...
>   fields = line.split delim
>   max = [max, fields].max
>   ...
> end

puts max    >>> 42

> what'dya think?


There's obviously some support for this, but to me it's unnecessary.
If I need to do code like that, I factor it into a method:

  def find_max(...)
    foo.bar.each do |quux|
      ...
      return max         # <- That, or ...
    end
    return max           #   ... that

  max = find_max(...)

I like small methods, and code like you've presented is a visual cue
for me to refactor.

None of this means the idea is without merit, though.

Gavin