Copyright © tutorialspoint.com
Code gets a little boring without flow control; for starters, Parrot knows about branching and labels. The branch op is equivalent to Perl's goto:
It can also perform simple tests to see whether a register contains a true value:
Here's what that would look like in Perl, for comparison:
Parrot OperatorWe have the full range of numeric comparators: eq, ne, lt, gt, le and ge. Note that you can't use these operators on arguments of disparate types; you may even need to add the suffix _i or _n to the op to tell it what type of argument you are using - although the assembler ought to divine this for you, by the time you read this. |
Copyright © tutorialspoint.com