Sha256: b5d10e52cfb75bf7b858d65c3fcad72e246069336fc93edba4205cf603b3a7b1

Contents?: true

Size: 326 Bytes

Versions: 47

Compression:

Stored size: 326 Bytes

Contents

# Declare package 'Leap' with version
package Leap 3;
use strict;
use warnings;
use Exporter 'import';
our @EXPORT_OK = qw(is_leap);

sub is_leap {
  my $year = shift;
  divisible_by($year, 400)
    or divisible_by($year, 4) and !divisible_by($year, 100)
    ? 1 : 0;
}

sub divisible_by {
  $_[0] % $_[1] == 0 ? 1 : 0;
}

1;

Version data entries

47 entries across 47 versions & 1 rubygems

Version Path
trackler-2.2.1.158 tracks/perl5/exercises/leap/.meta/solutions/Leap.pm
trackler-2.2.1.157 tracks/perl5/exercises/leap/.meta/solutions/Leap.pm
trackler-2.2.1.156 tracks/perl5/exercises/leap/.meta/solutions/Leap.pm
trackler-2.2.1.155 tracks/perl5/exercises/leap/.meta/solutions/Leap.pm
trackler-2.2.1.154 tracks/perl5/exercises/leap/.meta/solutions/Leap.pm
trackler-2.2.1.153 tracks/perl5/exercises/leap/.meta/solutions/Leap.pm
trackler-2.2.1.152 tracks/perl5/exercises/leap/.meta/solutions/Leap.pm
trackler-2.2.1.151 tracks/perl5/exercises/leap/.meta/solutions/Leap.pm
trackler-2.2.1.150 tracks/perl5/exercises/leap/.meta/solutions/Leap.pm
trackler-2.2.1.149 tracks/perl5/exercises/leap/.meta/solutions/Leap.pm
trackler-2.2.1.148 tracks/perl5/exercises/leap/.meta/solutions/Leap.pm
trackler-2.2.1.147 tracks/perl5/exercises/leap/.meta/solutions/Leap.pm
trackler-2.2.1.146 tracks/perl5/exercises/leap/.meta/solutions/Leap.pm
trackler-2.2.1.145 tracks/perl5/exercises/leap/.meta/solutions/Leap.pm
trackler-2.2.1.144 tracks/perl5/exercises/leap/.meta/solutions/Leap.pm
trackler-2.2.1.143 tracks/perl5/exercises/leap/.meta/solutions/Leap.pm
trackler-2.2.1.142 tracks/perl5/exercises/leap/.meta/solutions/Leap.pm
trackler-2.2.1.141 tracks/perl5/exercises/leap/.meta/solutions/Leap.pm
trackler-2.2.1.140 tracks/perl5/exercises/leap/.meta/solutions/Leap.pm
trackler-2.2.1.139 tracks/perl5/exercises/leap/.meta/solutions/Leap.pm