omega-mcp
aien-dev/omega-mcp
Brought by drakestapleton
omega-mcp / data / examples / arrays.om
| 1 | note a local array (new), a global pool, view and edit parameters, get, put and len |
| 2 | global tot ulong 1 |
| 3 | fn sum a view uint 4 to uint |
| 4 | s = uint 0 |
| 5 | for i ulong len a |
| 6 | s = add s get a i |
| 7 | end |
| 8 | ret s |
| 9 | end |
| 10 | fn fill a edit uint 4 to void |
| 11 | for i ulong 4 |
| 12 | put a i uint add i 1 |
| 13 | end |
| 14 | end |
| 15 | fn main to int |
| 16 | a = new uint 4 0 |
| 17 | fill a |
| 18 | put tot 0 ulong sum a |
| 19 | ret int get tot 0 |
| 20 | end |