突围foreach循环的,我有这个下面的代码不能在斯卡拉
> .foreach("${plist}", "newshole") {
> exec(
> http("get the user id")
> .get("${newshole}/jcr:content.1.json")
> .headers(headers_2)
> .check(bodyString.saveAs("Res1"))
> )
> exec(session => {
> var mynewshole = session("Res1").as[String]
> if (!mynewshole.contains("testingInProgress")) {
> println("Doesn't contain: " + mynewshole)
> (http("post the user id")
> .post("${newshole}/jcr:content")
> .headers(headers_2)
> .formParam("testingInProgress", session.userId))
> exec(http("Create print package")
> .post("/bin/cqtg-create-print-package.do")
> .headers(headers_2)
> .formParam("newsholeId", "${plist}")
> .formParam("digitalMasterId", "1adpy8")
> .check(status.is(200)))
>
> }
> session
> })
> }
我想打出来的:
> if (!mynewshole.contains("testingInProgress")) {
> println("Doesn't contain: " + mynewshole)
> (http("post the user id")
> .post("${newshole}/jcr:content")
> .headers(headers_2)
> .formParam("testingInProgress", session.userId))
> exec(http("Create print package")
> .post("/bin/cqtg-create-print-package.do")
> .headers(headers_2)
> .formParam("newsholeId", "${plist}")
> .formParam("digitalMasterId", "1adpy8")
> .check(status.is(200)))
>
> }
> session
基本上我想要从环路时,我的第一个条件满足爆发。所以我想按照scala教程使用下面的代码,但不知道在哪里放置易碎的命令,因为它给了我错误。
> breakable{
> code()
> break;
> }
但不知道往哪里放it.Any理念????
你可能想考虑**递归**,因为你正在使用Scala :-) – pietro909
基本上我只是想跳出循环,因为scala donot已经中断或继续明确定义。在scala中找到新的位置需要帮助! ! :( – shab