Even or odd
Built-in methods:
var n = 42;
say n.is_odd; # false
say n.is_even; # true
Checking the last significant digit:
func is_odd(n) { n&1 == 1 };
func is_even(n) { n&1 == 0 };
Using modular congruences:
func is_odd(n) { n%2 == 1 };
func is_even(n) { n%2 == 0 };