Packages

class Breaks extends AnyRef

A class that can be instantiated for the break control abstraction. Example usage:

val mybreaks = new Breaks
import mybreaks.{break, breakable}

breakable {
  for (...) {
    if (...) break()
  }
}

Calls to break from one instantiation of Breaks will never target breakable objects of some other instantiation.

Source
Breaks.scala
Linear Supertypes
Known Subclasses
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Breaks
  2. AnyRef
  3. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new Breaks()

Type Members

  1. sealed trait TryBlock[T] extends AnyRef

Value Members

  1. def break(): Nothing

    Break from dynamically closest enclosing breakable block using this exact Breaks instance.

    Break from dynamically closest enclosing breakable block using this exact Breaks instance.

    Note

    This might be different than the statically closest enclosing block!

  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.

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

    This variant enables the execution of a code block in case of a break():

    This variant enables the execution of a code block in case of a break():

    tryBreakable {
      for (...) {
        if (...) break()
      }
    } catchBreak {
      doCleanup()
    }