Files
Toy/examples/leapyear.toy
T
Ratstail91 92e4a41662 Renamed 'scripts' directory to 'examples'
Also allowed assignment within conditionals
2026-05-26 23:42:33 +10:00

19 lines
222 B
Plaintext

//is 'n' a leap year
fn isLeapYear(n: Int) {
if (n % 400 == 0) return true;
if (n % 100 == 0) return false;
return n % 4 == 0;
}
{
print isLeapYear(1999);
}
{
print isLeapYear(2000);
}
{
print isLeapYear(2004);
}