Fair enough, too. It’s just that the following code
action1(blah, blah, blah)
LOG.info “done action 1”
action2(blah, blah, blah)
LOG.info “done action 1”
action3(blah, blah, blah)
LOG.info “done action 1”
is more readable to me as
action1(blah, blah, blah) and
LOG.info “done action 1”
action2(blah, blah, blah) and
LOG.info “done action 1”
action3(blah, blah, blah) and
LOG.info “done action 1”
Even
action1(blah, blah, blah)
LOG.info “done action 1”
action2(blah, blah, blah)
LOG.info “done action 1”
action3(blah, blah, blah)
LOG.info “done action 1”
doesn’t really cut it for me.
I like the shortcut
action and followup
for
if action
followup
end
or
followup if action
occasionally. Depends what’s going on in my head.
Gavin
···
----- Original Message -----
From: “Bulat Ziganshin” bulatz@integ.ru
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Wednesday, October 30, 2002 5:38 PM
Subject: Re: “multiple assignment in conditional”
Hello Gavin,
Wednesday, October 30, 2002, 9:29:35 AM, you wrote:
a, b = foo; puts a
It’s really a matter of style. The actual line of code is like this:
results, duplicates = @scraper.get_backend_ids(last_record) and
LOG.info “Retrieved backend IDs: #{results.length} of them”
imvho, it’s better to omit “and” because in ruby “and” is logical
operator and anyone else can’t understand your code. i personally will
spend much time finding condition when first line will be “false”