omega-mcp
aien-dev/omega-mcp
Brought by drakestapleton
omega-mcp / data / examples / control.om
| 1 | note while with a bound, continue, break, for, if/else and bool values |
| 2 | fn pick c bool to uint |
| 3 | if c |
| 4 | ret 100 |
| 5 | else |
| 6 | ret 1 |
| 7 | end |
| 8 | end |
| 9 | fn main to int |
| 10 | s = uint 0 |
| 11 | i = uint 0 |
| 12 | while lt i 100 bound 1000 |
| 13 | i = add i 1 |
| 14 | if eq rem i 2 0 |
| 15 | continue |
| 16 | end |
| 17 | if gt i 9 |
| 18 | break |
| 19 | end |
| 20 | s = add s i |
| 21 | end |
| 22 | for j uint 4 |
| 23 | s = add s j |
| 24 | end |
| 25 | t = true |
| 26 | f = false |
| 27 | s = add s pick and t not f |
| 28 | ret int s |
| 29 | end |