To create an enumeration, create an object that extends the abstract class Enumeration
, and set a val
variable to the method Value
.
To create an enumeration, create an object that extends the abstract class Enumeration
, and set a val
variable to the method Value
. This is a trick to give values to each val
.
Value
assigns a numerical value to fields:
You can extend the Enumeration
by extending the Value
class.
Enumerations can be declared in one line if you are merely setting variables to Value
:
You can create an enumeration with your own index and your own Strings, in this exercise we will start with an index of one and use Greek names instead of Roman:
Enumerations can be declared with a string value only:
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