没有break和continue真的很不方便啊

7 views
Skip to first unread message

威 戴

unread,
Jun 27, 2011, 12:53:49 AM6/27/11
to Scala中文社区
val canNext = true
for (
i <- 1 to 10
canNext
) {
...
if (...) canNext = false
}
话说写过滤器的话经常还有预先定义变量,代码行数变多了啊可恶。

lin qing

unread,
Jun 27, 2011, 1:23:50 AM6/27/11
to Scala中文社区
这个不是实际代码,有真实代码贴出来可以看看。

Xuefeng Wu

unread,
Jun 27, 2011, 1:48:13 AM6/27/11
to sca...@googlegroups.com
話說你可以:
import scala.util.control.Breaks._
breakable{
 for(i <- 1 to 10){
   if(...) break;
 }

}

2011/6/27 威 戴 <dave...@gmail.com>

--
您收到此邮件是因为您订阅了 Google 网上论坛的“Scala中文社区”论坛。
要向此网上论坛发帖,请发送电子邮件至 sca...@googlegroups.com
要取消订阅此网上论坛,请发送电子邮件至 scalacn+u...@googlegroups.com
若有更多问题,请通过 http://groups.google.com/group/scalacn?hl=zh-CN 访问此网上论坛。




--
Best Regards,
Alan Wu/吴雪峰

-----------------

Global R&D Center,Shanghai,Carestream Health
Email:xuefe...@carestreamhealth.com
Tel:(86-21)3852 6101
Rayco(Shanghai) Medical Products Co., Ltd.
锐珂(上海)医疗器材有限公司

lin qing

unread,
Jun 27, 2011, 2:11:08 AM6/27/11
to Scala中文社区
居然有这种东西,你怎么会翻出来这种东西呀?分享一下

On 6月27日, 下午1时48分, Xuefeng Wu <xuefeng...@carestream.com> wrote:
> 話說你可以:
> import scala.util.control.Breaks._
> breakable{
> for(i <- 1 to 10){
> if(...) break;
> }
>
> }
>

> 2011/6/27 威 戴 <davepk...@gmail.com>


>
>
>
>
>
> > val canNext = true
> > for (
> > i <- 1 to 10
> > canNext
> > ) {
> > ...
> > if (...) canNext = false
> > }
> > 话说写过滤器的话经常还有预先定义变量,代码行数变多了啊可恶。
>
> > --
> > 您收到此邮件是因为您订阅了 Google 网上论坛的"Scala中文社区"论坛。
> > 要向此网上论坛发帖,请发送电子邮件至 sca...@googlegroups.com
> > 要取消订阅此网上论坛,请发送电子邮件至 scalacn+u...@googlegroups.com
> > 若有更多问题,请通过http://groups.google.com/group/scalacn?hl=zh-CN访问此网上论坛。
>
> --
> Best Regards,
> Alan Wu/吴雪峰
>
> -----------------
>
> Global R&D Center,Shanghai,Carestream Health

> Email:xuefeng...@carestreamhealth.com

Xuefeng Wu

unread,
Jun 27, 2011, 2:59:21 AM6/27/11
to sca...@googlegroups.com

lin qing

unread,
Jun 27, 2011, 3:10:17 AM6/27/11
to Scala中文社区
我现在光顾着写程序了, scala没怎么仔细学。
Programing in scala就翻了一遍, exploring liftweb看了三分之一就开始做项目了。
计划是说把项目稳定下来再重新看书,重新翻翻scala和liftweb的源码;
昨天在上海书城买了本《Real World Haskell》,恶补下functional基础先。

另外,我在http://www.artima.com/买了一本《Programing In Scala Second Edition》英文版,
好几百元啦,一直没收到,
谁要英语好帮我要过来,我就送给他,借我看一个月就行了。

On 6月27日, 下午2时59分, Xuefeng Wu <xuefeng...@carestream.com> wrote:
> 這是scala2.8類庫的東西http://www.scala-lang.org/archives/downloads/distrib/files/nightly/do...
>
> google一下就可以了。
>
> 2011/6/27 lin qing <linqin...@gmail.com>

威 戴

unread,
Jun 27, 2011, 3:26:37 AM6/27/11
to Scala中文社区
看起来还是好麻烦

On 6月27日, 下午1时48分, Xuefeng Wu <xuefeng...@carestream.com> wrote:

> 話說你可以:
> import scala.util.control.Breaks._
> breakable{
> for(i <- 1 to 10){
> if(...) break;
> }
>
> }
>

> 2011/6/27 威 戴 <davepk...@gmail.com>


>
>
>
>
>
>
>
>
>
> > val canNext = true
> > for (
> > i <- 1 to 10
> > canNext
> > ) {
> > ...
> > if (...) canNext = false
> > }
> > 话说写过滤器的话经常还有预先定义变量,代码行数变多了啊可恶。
>
> > --
> > 您收到此邮件是因为您订阅了 Google 网上论坛的"Scala中文社区"论坛。
> > 要向此网上论坛发帖,请发送电子邮件至 sca...@googlegroups.com
> > 要取消订阅此网上论坛,请发送电子邮件至 scalacn+u...@googlegroups.com
> > 若有更多问题,请通过http://groups.google.com/group/scalacn?hl=zh-CN访问此网上论坛。
>
> --
> Best Regards,
> Alan Wu/吴雪峰
>
> -----------------
>
> Global R&D Center,Shanghai,Carestream Health

> Email:xuefeng...@carestreamhealth.com

Xuefeng Wu

unread,
Jun 27, 2011, 3:30:01 AM6/27/11
to sca...@googlegroups.com
是啊,能不用就不用

2011/6/27 威 戴 <dave...@gmail.com>
Email:xuefe...@carestreamhealth.com
Reply all
Reply to author
Forward
0 new messages