2
A
回答
4
还有就是要实现这一行为没有简单的方法,但也许下面的建议将帮助。
您可以通过定义属性myBreakProperty
获得像一个休息当你发现你需要打破
<for list="a,b,c,d,e" param="letter" keepgoing="true">
<sequential>
<if>
<equals arg1="@{letter}" arg2="c" />
<then>
<property name="myBreakProperty" value="nevermind the value"/>
</then>
</if>
<fail if="myBreakProperty"/>
<echo>Letter @{letter}</echo>
</sequential>
</for>
输出将是:Letter a Letter b
要获得类似于cont inue:
<for list="a,b,c,d,e" param="letter" keepgoing="true">
<sequential>
<if>
<equals arg1="@{letter}" arg2="c" />
<then>
<fail/>
</then>
</if>
<echo>Letter @{letter}</echo>
</sequential>
</for>
输出将是:Letter a Letter b Letter d Letter e
1
您可以休息一下流程,而无需运行苛刻的失败的东西。使用属性来检测你想要打破什么时候你可以实现这样的事情:
<var name="break.flag" unset="true"/>
<for list="a,b,c,d,e" param="letter">
<sequential>
<if>
<not>
<isset property="break.flag"/>
</not>
<then>
<if>
<equals arg1="@{letter}" arg2="c" />
<then>
<property name="break.flag" value="true"/>
</then>
</if>
<if>
<not>
<isset property="break.flag"/>
</not>
<then>
<echo>Letter @{letter}</echo>
<echo>Do the rest of the loop here</echo>
</then>
</if>
</then>
</if>
</sequential>
</for>
+0
你的代码不起作用,你需要取消设置标志,如果它击中 – sloven 2017-03-03 21:10:09
相关问题
- 1. Java:如果加入线程无效:中断还是继续?
- 2. 如何在ios/xcode中声明c后继续执行或继续执行?
- 3. Haskell:继续执行程序
- 4. Lua继续执行脚本
- 5. 继续执行异常
- 6. 继续执行DOM命令
- 7. 如果断言失败,请继续执行脚本
- 8. 如何让用户选择继续执行程序还是退出程序(C#)
- 9. 中断一个方法,但继续执行代码的剩余部分
- 10. 在PHP上继续执行SQL查询
- 11. 关闭连接并继续执行
- 12. 错误时继续执行代码
- 13. 窗口出现后继续执行
- 14. 试着抓住异常继续执行
- 15. 自动执行shell按Enter键继续
- 16. 无后退按钮执行继续?
- 17. JavaScript执行后返回false继续
- 18. 继续执行几项任务
- 19. 任务继续执行多个任务
- 20. 忽略KeyError并继续执行程序
- 21. JSON失败并继续执行代码
- 22. 的Javascript:Ajax错误后继续执行
- 23. Js脚本继续执行onchange
- 24. 在后台继续执行任务
- 25. 多个ListenableFutures返回后继续执行
- 26. 继续执行一个功能
- 27. 一次性警报继续执行
- 28. 在投掷JS后继续执行
- 29. 如何继续执行此查询
- 30. 停止并继续执行JavaScript
谢谢!这工作。 – 2013-04-08 19:34:55