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/tests/compiler/progs/ifchain.osc # 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 / tests / compiler / progs / ifchain.osc` 24 lines ยท 552 bytes Raw Blame History 1 // entry: classify grade 2 // if / else if / else chains. 3 fn classify(x: i32) -> u8 { 4 if x < -1000 { 5 return 0; 6 } else if x < 0 { 7 return 1; 8 } else if x == 0 { 9 return 2; 10 } else if x <= 1000 { 11 return 3; 12 } else { 13 return 4; 14 } 15 } 16 17 fn grade(score: u8, bonus: bool) -> u8 { 18 let mut s: u16 = score as u16; 19 if bonus { s = s + 10; } 20 let mut g: u8 = 0; 21 if s >= 90 { g = 4; } else if s >= 80 { g = 3; } else if s >= 70 { g = 2; } else { g = 1; } 22 if s > 255 { g = 9; } 23 return g; 24 }