7 ms·
Yes, many of the "tricks" are Perl-esque. But #16 is a good one — I like one liners but after reading I looked through the code base in one of my projects and
by pauljonas 18y ago
Yes, many of the "tricks" are Perl-esque.
But #16 is a good one — I like one liners but after reading I looked through the code base in one of my projects and sure enough, explicit true/false was spelled out in methods returning booleans...
(rand < event_prob) ? true : false
Shorter and sweeter...
(rand < event_prob)
As opposed to the hideous...
if event_prob
return true
else
return false
end
- tptacek 18y agoThat "trick" is in K&R.