interplane.Get Omega
Read in your language

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

branch main Branches Tags History

omega-mv / seed / omc / tests / struct-bool / param_edit.om

30 lines · 551 bytes Raw Blame History
1note param_edit.om: a bool field written and read through an edit parameter, and a bool value
2note passed as a parameter. set true, flip, set false; the caller sees every change. Result 7.
3struct W a uint f bool end
4fn setf p edit W v bool to void
5put p f v
6end
7fn flip p edit W to void
8if eq get p f true
9put p f false
10else
11put p f true
12end
13end
14fn main to uint
15w = new W 3 false
16r = uint 0
17setf w true
18if eq get w f true
19r = add r 1
20end
21flip w
22if eq get w f false
23r = add r 2
24end
25flip w
26if eq get w f true
27r = add r 4
28end
29ret add r sub get w a 3
30end