From d7d5f00e38f2288e569fda52e48f5b925ab1ca4d Mon Sep 17 00:00:00 2001 From: E7-87-83 Date: Thu, 20 May 2021 08:17:08 +0800 Subject: condense by tertiary operator --- challenge-113/cheok-yin-fung/perl/ch-1.pl | 14 ++------------ 1 file 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) { -- cgit