object Continue extends Continue with Keyword[Continue, Nothing] with Product with Serializable
A keyword to skip the current iteration in a collection comprehension block.
Author:
杨博 (Yang Bo)
- Source
- Continue.scala
Each and Continue can be used to calculate composite numbers and prime numbers.
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))
- Note
This Continue keyword is usually used with Each, to skip an element in the loop.
- See also
Each for creating collection comprehensions.
- Alphabetic
- By Inheritance
- Continue
- Serializable
- Serializable
- Product
- Equals
- Continue
- Keyword
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- implicit def OptionContinueDsl[Value, Element](implicit factory: Factory[Element, Option[Element]]): Dsl[Continue, Option[Element], Value]
-
final
def
apply[Domain](handler: (Nothing) ⇒ Domain)(implicit dsl: Dsl[Continue, Domain, Nothing]): Domain
An alias to cpsApply.
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
- 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]
-
final
def
cpsApply[Domain](handler: (Nothing) ⇒ Domain)(implicit dsl: Dsl[Continue, Domain, Nothing]): Domain
- Definition Classes
- Keyword
- Annotations
- @inline()
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
- final def unary_!: Nothing
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()