Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/si/rosetta/tasks/leap-year/leap-year.om # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / si / rosetta / tasks / leap-year / leap-year.om` 58 lines ยท 957 bytes Raw Blame History 1 note Rosetta Code task "Leap year": https://rosettacode.org/wiki/Leap_year 2 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 3 om2 4 text yes " is a leap year\n" 5 text no " is not a leap year\n" 6 note emit writes every byte of a to stdout; a short write is retried, an error exits 1 7 fn emit a view uchar * to void 8 o = ulong 0 9 while lt o len a bound 4096 10 k = write 1 a o sub len a o 11 if le k 0 12 exit 1 13 end 14 o = add o ulong k 15 end 16 end 17 note emitu writes n in decimal; 20 digits hold every ulong 18 fn emitu n ulong to void 19 d = new uchar 20 0 20 i = ulong 20 21 v = n 22 while true bound 20 23 i = sub i 1 24 put d i uchar add rem v 10 48 25 v = div v 10 26 if eq v 0 27 break 28 end 29 end 30 emit part d i sub 20 i 31 end 32 fn leap y ulong to bool 33 if eq rem y 400 0 34 ret true 35 end 36 if eq rem y 100 0 37 ret false 38 end 39 ret eq rem y 4 0 40 end 41 fn show y ulong to void 42 emitu y 43 if leap y 44 emit yes 45 else 46 emit no 47 end 48 end 49 fn main to int 50 show 1900 51 show 1996 52 show 2000 53 show 2023 54 show 2024 55 show 2100 56 show 2400 57 ret 0 58 end