http://qs321.pair.com?node_id=11124045


in reply to Re^3: What's the right way to write a method which returns one line at a time from a file?
in thread What's the right way to write a method which returns one line at a time from a file?

That is ridiculous: the else block is only executed if the condition on the if is false. Since the return is in the if block, it is only executed if the condition tested evaluates to true, which means that the else would never be executed anyway.

This is a perfectly legitimate construct when different return values must be produced in different conditions, or when an early exit is needed under some conditions.