Re:Push ifs up and fors down
by BenFrantzDale on Thursday November 16, 2023 @07:30AM
(#38288759)
I thought that too. I think the point there was that you don’t have to push this notion as afar as in/out of functions: that just flipping them within a function can be beneficial.
if condition { for walrus in walruses { walrus.frobnicate() } } else { for walrus in walruses { walrus.transmogrify() } } and not this?
if condition { frobnicate_batch(walruses) } else { transmogrify_batch(walruses) }