Continue

case
object Continue extends Continue

A keyword to skip the current iteration in a collection comprehension block.

Authors

杨博 (Yang Bo)

See also

Each for creating collection comprehensions.

Note

This Continue keyword is usually used with Each, to skip an element in the loop.

Example

Each and Continue can be used to calculate composite numbers and prime numbers.

        import com.thoughtworks.dsl.bangnotation._
        def compositeNumbersBelow(maxNumber: Int) = *[collection.immutable.HashSet] {
          val factor = !Each(2 until math.ceil(math.sqrt(maxNumber)).toInt)
          !Each(2 * factor until maxNumber by factor)
        }
        compositeNumbersBelow(13) should be(Set(4, 6, 8, 9, 10, 12))
        def primeNumbersBelow(maxNumber: Int) = *[Seq] {
          val compositeNumbers = compositeNumbersBelow(maxNumber)
          val i = !Each(2 until maxNumber)
          if (compositeNumbers(i)) !Continue
          i
        }
        primeNumbersBelow(13) should be(Array(2, 3, 5, 7, 11))
Companion
class
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
class Continue
class Object
trait Matchable
class Any

Type members

Inherited types

type MirroredElemLabels = EmptyTuple
Inherited from
Singleton
type MirroredElemTypes = EmptyTuple
Inherited from
Singleton
type MirroredLabel <: String

The name of the type

The name of the type

Inherited from
Mirror
type MirroredMonoType = Singleton
Inherited from
Singleton
type MirroredType = Singleton
Inherited from
Singleton

Value members

Inherited methods

def fromProduct(p: Product): MirroredMonoType
Inherited from
Singleton
def productElementNames: Iterator[String]
Inherited from
Product
def productIterator: Iterator[Any]
Inherited from
Product

Implicits

Implicits

implicit
def OptionContinueDsl[Value, Element](implicit factory: Factory[Element, Option[Element]]): Dsl[Continue, Option[Element], Value]
implicit
def collectionContinueDsl[Value, Element, Collection[_]](implicit factory: Factory[Element, Collection[Element]]): Dsl[Continue, Collection[Element], Value]
implicit
def continueUnitDsl[Value]: Dsl[Continue, Unit, Value]