mirror of https://git.sr.ht/~garritfra/sabre
Garrit Franke
3 years ago
5 changed files with 70 additions and 13 deletions
@ -1,17 +1,5 @@ |
|||||||
// There are no nested expressions yet, so we have to hack a little bit |
// There are no nested expressions yet, so we have to hack a little bit |
||||||
|
|
||||||
fn main() { |
fn main() { |
||||||
let year = 2020 |
let arr = ["Foo", "Bar", "Baz"] |
||||||
|
|
||||||
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" |
|
||||||
} |
|
||||||
} |
} |
Loading…
Reference in new issue