News for hackers. Stuff that matters.
Re:Anti-If: The missing patterns (2016) by TooBrokeToBeg on Wednesday June 27, 2018 @11:44AM (#17409084)
Depending on the language and values, the latter does not mean the same thing.

    <?php
    $x = 1;$y = 2;

    function test1($x, $y) {
        if ($x) {
            return $y;
        } else {
            return false;
        }
    }

    function test2($x, $y) {
        return $x && $y;
    }

    var_dump(test1($x,$y));
    echo "\n";
    var_dump(test2($x,$y));
Re:Anti-If: The missing patterns (2016) by moomin on Wednesday June 27, 2018 @01:20PM (#17409991)
Since we’re discussing readability, let’s be generous and assume the code behaves the same.

Since otherwise, it’s not a question of readability anymore. (But yes, incorrect transformations are incorrect.)