aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorE7-87-83 <fungcheokyin@gmail.com>2021-05-20 08:17:08 +0800
committerE7-87-83 <fungcheokyin@gmail.com>2021-05-20 08:17:08 +0800
commitd7d5f00e38f2288e569fda52e48f5b925ab1ca4d (patch)
tree10cceda802addbaad515359df213ea5e7b4af2d8
parent63870977489f600abb9ea1a95da6579dfbdeb7c0 (diff)
downloadperlweeklychallenge-club-d7d5f00e38f2288e569fda52e48f5b925ab1ca4d.tar.gz
perlweeklychallenge-club-d7d5f00e38f2288e569fda52e48f5b925ab1ca4d.tar.bz2
perlweeklychallenge-club-d7d5f00e38f2288e569fda52e48f5b925ab1ca4d.zip
condense by tertiary operator
-rw-r--r--challenge-113/cheok-yin-fung/perl/ch-1.pl14
1 files changed, 2 insertions, 12 deletions
diff --git a/challenge-113/cheok-yin-fung/perl/ch-1.pl b/challenge-113/cheok-yin-fung/perl/ch-1.pl
index 6197890686..b037a62544 100644
--- a/challenge-113/cheok-yin-fung/perl/ch-1.pl
+++ b/challenge-113/cheok-yin-fung/perl/ch-1.pl
@@ -34,21 +34,11 @@ sub representable {
return 0 if $D == 2 || $D == 5;
if ($D == 4 && $N > 10) {
- if ($N % 2 == 0) {
- return 1;
- }
- else {
- return 0;
- }
+ return $N % 2 == 0 ? 1 : 0;
}
if ($D == 8 && $N >= 40) {
- if ($N % 2 == 0) {
- return 1;
- }
- else {
- return 0;
- }
+ return $N % 2 == 0 ? 1 : 0;
}
if ($D == 6) {