Created
May 15, 2012 07:53
-
-
Save alexbezhan/2699837 to your computer and use it in GitHub Desktop.
Play japid break in for loop
This file contains 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
`for Ingredient ingredient: ingredients | |
`ingredient.product.get(); | |
`if (_index < 4 || ingredients.size() == 4) { | |
`${ingredient.product.name} | |
`} else if (_index == 4){ | |
<li>...</li> | |
`} else { | |
`break; | |
`} | |
` |
Currently break does not work in open for loops, neither does continue. The return hack in the above sample works like a "continue".
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can use "return" instead, but do remember there must be no space between the "}" and "return".
for Ingredient ingredient: ingredients`
ingredient.product.get();``if (_index < 4 || ingredients.size() == 4) {
${ingredient.product.name}`
} else if (_index == 4){``} else {
``return;}`