by tasty_freeze · 9y ago · 0 comments
print "true" if (a < b);
I recall seeing dialects of BASIC back in the 70s which supported it as well. Who knows, maybe this is where Perl got it from.I use the post conditional most often in perl in this way:
foreach my $foo (@collection) {
next if (I-dont-care-about-this-$foo);
next if (another-reason-for-ignoring-$foo);
do_something($foo);
} def do_something(arg1, arg2)
return false if arg1.is_invalid
return false if arg2 < sane
...
end
The trailing `unless` is also handy, and I find it a bit nicer to read compared to a negated `if`.