~garritfra/antimony

antimony/examples/leapyear.sb -rw-r--r-- 389 bytes
36db9aecGarrit Franke remove accidental test file 1 year, 1 month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// 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 {
        println("Leap year")
    } else {
        println("Not a leap year")
    }
}