100 doors: Difference between revisions
→{{header|EMal}}
(→Insitux: implementation) |
|||
Line 5,254:
=={{header|EMal}}==
<syntaxhighlight lang="
type Door:State
enum do int CLOSED, OPEN end
Line 5,262:
Door:State state
new by int =id, Door:State =state do end
fun toggle ← <|me.state ← when(me.state æ Door:State.CLOSED, Door:State.OPEN, Door:State.CLOSED)
fun asText ← <|"Door #" + me.
end
type Main
^|There are 100 doors in a row that are all initially closed.|^
List doors
^|You make 100 passes by the doors.|^
for int pass
for int i
doors[i].toggle()
end
Line 5,283 ⟶ 5,276:
^|Which are open, which are closed?|^
for each Door door in doors
if door.state
writeLine(door)
end
|