Created
December 15, 2012 19:57
-
-
Save bakkdoor/4298687 to your computer and use it in GitHub Desktop.
Sample implementation of while loop with additional else branch, if loop doesn't get executed (in Fancy).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Object { | |
def while: condition do: body else: alternative { | |
if: (condition call) then: { | |
body call | |
while: condition do: body | |
} else: alternative | |
} | |
} | |
# usage: | |
while: { 100 random > 25 } do: { | |
"Got a random number > 25" println | |
} else: { | |
"Failed to get a random number > 25" println | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment