How Does One Make Scala Control Abstraction in Repeat Until? -


I am Peter Pilgrim, I see that Martin Odersky makes a control intangible in Scala. However, I still can not repeat it within IntelliJ IDEA 9. Is this IDE? : = : = & Gt; Boolean) {body; Value Value: Boolean = fund; Println ("value =" + value) if (value) repeat loop (body). Unless (cond) // if (cond)}} def doTest2 (): unit = {var y: int = 1 println ("test ... to repeat () control structure") repeat loop {Readln ("found y =" + y) y = y + 1} {up (y & lt; 10)}}}

reads the error message:

< Blockquote>

information: 1 error and complete compilation with 0 warnings
Information: Error 1
Information: 0 Alerts
C: \ User \ Peter \ IdeaProjects \ HelloWord \ src \ demo \ Control Scala - error: error: line (57) error: control.this.repeatLoop ({
scala.this.Predef.println ("found y =". (Y));; y = y. + (1)
} type Do not take the parameters until this - repeat loop {/ p>

In this the query function, the body can be thought to return expression (the value of Y + 1), although repeat The parameter of the body of the declaration of knowing clearly states that it can be ignored or not?

What does the error mean?

here StackOverflowError without a solution.

  Scala> Class Condition IsTrueException RuntimeException Defined Class ConditionIsTrueException Scala & gt; DF double (body: => unit) = new {| Def to (condition: => boolean) = {| Try {| While (true) {| Body | If (condition) leave the new condition ITrueException | } | } Hold {| Case E: Condition IsTrueException = & gt; | } | | } | } Repeat: (body: => entity) java.lang.Object {def (condition: = & gt; boolean): Unit} Skale & gt; Var i = 0 i: Int = 0 Scala & gt; Repeat {println (i); I + = 1} until (i == 3) 0 1 2 scale & gt; Repeat until {i + = 1} (i == 100000) scale & gt; Repeat until {i + = 1} (i == 1000000) scale & gt; Repeat until {i + = 1} scale (i == 10000000) scale & gt; Repeat until {i + = 1} scale (i == 100000000) scale & gt; According to Jasper and Rex Kerr, there is a solution without exception.  
  DEF repeats (body = => unit) = new {Diff up (condition: = & gt; boolean) = {{body} while (bet!)}}  

Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -