Created
September 29, 2012 19:20
-
-
Save Buildstarted/3804984 to your computer and use it in GitHub Desktop.
Possible ways to do conditionals inp parrot
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
| conditional(condition) { | |
| true > lots of statements | |
| false > lots of other statements | |
| default > "will be called when condition doesn't match anything else" | |
| } | |
| conditional(condition) { | |
| a > some value | |
| b > something else | |
| c > blah blah | |
| someotherstatementtype > result | |
| } | |
| conditional(Name) { | |
| 'ben' > 'your name is ben' | |
| 'not ben' > 'your name is not ben' | |
| } | |
| conditional(Name) { | |
| 'ben' | |
| { | |
| 'your name is ben' | |
| } | |
| 'not ben' | |
| { | |
| 'your name is not ben' | |
| } | |
| } | |
| essentially it's a switch statement |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment