cow programming language code example

Example 1: cow programming language

[[ copy current to temp block ]]
MMM
moO
MMM
[[ copy 3 into another new temp block ]]
moO
OOO
MoO
MoO
MoO
[[ loop 3 times (the 3 is still current) ]]
[[  this also decrements the temp value ]]
MOO
MOo
mOo
MOo
moO
moo
[[ move back to first temp value (the copy of the current value) and check if 0 ]]
mOo
MOO
[[ make original current current again ]]
mOo
OOM
[[ gets here if != 3 ]]
[[ skip down to the bottom past the if ]]
moO
OOO
MOO
moo
[[ make original current current again ]]
mOo
OOM
[[ gets here if == 3 ]]
[[ skip down to the bottom of the if ]]
moO
OOO
MOO
moo
moo
[[ set current back ]]
mOo
[[ all execution resumes here ]]

Example 2: cow programming language

OOO
MOo
mOO

Tags:

Misc Example