Skip to content

Comment on Yoda Conditionsparent

Comments

To clarify a bit: postfix conditionals actually originate from Perl, and are one of several things that Ruby inherited as a Perl descendant.

In Perl:

    if ($x > 0) { $y += $x }
versus:
    $y += $x if $x > 0;
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.