Packages

object Breaks extends Breaks

An object that can be used for the break control abstraction.

Example usage:

import Breaks.{break, breakable}

breakable {
  for (...) {
    if (...) break
  }
}
Source
Breaks.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Breaks
  2. Breaks
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. sealed trait TryBlock[T] extends AnyRef
    Definition Classes
    Breaks

Value Members

  1. def break(): Nothing

    Break from the dynamically closest enclosing breakable block that also uses this Breaks instance.

    Break from the dynamically closest enclosing breakable block that also uses this Breaks instance.

    Definition Classes
    Breaks
    Note

    This might be different from the statically closest enclosing block!

    ,

    Invocation without parentheses relies on the conversion to "empty application".

  2. def breakable(op: => Unit): Unit

    A block from which one can exit with a break.

    A block from which one can exit with a break. The break may be executed further down in the call stack provided that it is called on the exact same instance of Breaks.

    Definition Classes
    Breaks
  3. def tryBreakable[T](op: => T): TryBlock[T]

    Try a computation that produces a value, supplying a default to be used if the computation terminates with a break.

    Try a computation that produces a value, supplying a default to be used if the computation terminates with a break.

    tryBreakable {
      (1 to 3).map(i => if (math.random < .5) break else i * 2)
    } catchBreak {
      Vector.empty
    }
    Definition Classes
    Breaks