mirror of https://git.sr.ht/~garritfra/sabre
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
385 B
17 lines
385 B
3 years ago
|
// There are no nested expressions yet, so we have to hack a little bit
|
||
|
|
||
|
fn main() {
|
||
|
let year = 2020
|
||
|
|
||
|
let divisibleBy4 = year % 4 == 0
|
||
|
let divisibleBy100 = year % 100 != 0
|
||
|
let divisibleBy400 = year % 400 == 0
|
||
|
|
||
|
let ly = divisibleBy4 && divisibleBy100
|
||
|
|
||
|
if ly || divisibleBy400 {
|
||
|
return "Leap year"
|
||
|
} else {
|
||
|
return "Not a leap year"
|
||
|
}
|
||
|
}
|