From Code to Community: Sponsoring The Perl and Raku Conference 2025 Learn more

#!/usr/bin/ruby
#
#
func is_prime(a) {
given (a) {
when (2) { true }
case (a <= 1 || a.is_even) { false }
default { range(3, a.sqrt) -> any { .divides(a) } -> not }
}
}
25.times { |i|
is_prime(i) && say i;
}