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 / loop_toggle.om

21 lines · 419 bytes Raw Blame History
1note loop_toggle.om: put and get on a bool field inside a loop. Seven flips from false end true;
2note the count of times the field read true on the way is 3. Result 3 * 10 + 1.
3struct W n uint f bool end
4fn main to uint
5w = new W 0 false
6for i uint 7
7if eq get w f true
8put w n add get w n 1
9end
10if eq get w f true
11put w f false
12else
13put w f true
14end
15end
16r = mul get w n 10
17if eq get w f true
18r = add r 1
19end
20ret r
21end