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/nested.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 / nested.osc` 27 lines ยท 664 bytes Raw Blame History 1 // entry: find_pair grid_walk 2 // nested loops with early return inside loops. 3 fn find_pair(target: i32) -> i32 { 4 for i in 0 .. 20 { 5 for j in 0 .. 20 { 6 if (i as i32) * 20 + (j as i32) == target { 7 return (i as i32) * 100 + (j as i32); 8 } 9 } 10 } 11 return -1; 12 } 13 14 fn grid_walk(n: u8, stop: u16) -> u16 { 15 let mut acc: u16 = 0; 16 let mut i: u8 = 0; 17 while i < n bound 12 { 18 let mut j: u8 = 0; 19 while j < i bound 12 { 20 acc = acc + (i as u16) * (j as u16); 21 if acc == stop { return 9999; } 22 j = j + 1; 23 } 24 i = i + 1; 25 } 26 return acc; 27 }