The result of partial functions can have an andThen
function added to the end of the chain:
Case statements are a quick way to create partial functions.
Case statements are a quick way to create partial functions. When you create a case statement, the apply
and isDefinedAt
methods are created automatically.
andThen
can be used to continue onto another chain of logic:
A partial function is a trait
that when implemented can be used as building blocks to determine a solution.
A partial function is a trait
that when implemented can be used as building blocks to determine a solution. The trait PartialFunction
requires that the method isDefinedAt
and apply
be implemented:
The parameterless execute method has been deprecated and will be removed in a future version of ScalaTest. Please invoke execute with empty parens instead: execute().
The trap method is no longer needed for demos in the REPL, which now abreviates stack traces, and will be removed in a future version of ScalaTest