if (...)
{
die ...;
}
else
{
# continue with the happy path
}
the provision of an else block is redundant, since it suggests (misleadingly) that the code can somehow die and yet still resume execution following the else — which it can’t.
For this case, I would prefer:
unless ($value == $expected_value)
{
$errorcount++;
die new Exception msg => "argh!";
}
# continue with the happy path
which reads more naturally (to my ear). (Note that the original objection was not to unless, but to unless ... else.)
Update: Nice use of the <abbr> tag, BTW — I’ve learnt something new, could come in handy. :-)
Athanasius <°(((>< contra mundum
|