@@ -325,8 +325,18 @@ The class has three constructors, given by the numbered comments in the code:
325
325
326
326
Those constructors can be called like this:
327
327
328
- {% tabs structor_2 %}
329
- {% tab 'Scala 2 and 3' for=structor_2 %}
328
+ {% tabs structor_2 class=tabs-scala-version %}
329
+ {% tab 'Scala 2' for=structor_2 %}
330
+
331
+ ``` scala
332
+ val s1 = new Student (" Mary" , " 123" )
333
+ val s2 = new Student (" Mary" , " 123" , LocalDate .now)
334
+ val s3 = new Student (" Mary" , " 123" , 456 )
335
+ ```
336
+
337
+ {% endtab %}
338
+
339
+ {% tab 'Scala 3' for=structor_2 %}
330
340
331
341
``` scala
332
342
val s1 = Student (" Mary" , " 123" )
@@ -836,7 +846,7 @@ Basic enumerations are used to define sets of constants, like the months in a ye
836
846
As an example, these enumerations define sets of attributes related to pizzas:
837
847
838
848
{% tabs enum_1 %}
839
- {% tab 'Scala 3 only ' for=enum_1 %}
849
+ {% tab 'Scala 3 Only ' for=enum_1 %}
840
850
841
851
```scala
842
852
enum CrustSize:
@@ -855,7 +865,7 @@ enum Topping:
855
865
To use them in other code, first import them, and then use them:
856
866
857
867
{% tabs enum_2 %}
858
- {% tab 'Scala 3 only ' for=enum_2 %}
868
+ {% tab 'Scala 3 Only ' for=enum_2 %}
859
869
860
870
```scala
861
871
import CrustSize.*
@@ -868,7 +878,7 @@ val currentCrustSize = Small
868
878
Enum values can be compared using equals (`==`), and also enum_1ed on:
869
879
870
880
{% tabs enum_3 %}
871
- {% tab 'Scala 3 only ' for=enum_3 %}
881
+ {% tab 'Scala 3 Only ' for=enum_3 %}
872
882
873
883
```scala
874
884
// if/then
@@ -890,7 +900,7 @@ currentCrustSize enum_1
890
900
Enumerations can also be parameterized:
891
901
892
902
{% tabs enum_4 %}
893
- {% tab 'Scala 3 only ' for=enum_4 %}
903
+ {% tab 'Scala 3 Only ' for=enum_4 %}
894
904
895
905
```scala
896
906
enum Color(val rgb: Int):
@@ -905,7 +915,7 @@ enum Color(val rgb: Int):
905
915
And they can also have members (like fields and methods):
906
916
907
917
{% tabs enum_5 %}
908
- {% tab 'Scala 3 only ' for=enum_5 %}
918
+ {% tab 'Scala 3 Only ' for=enum_5 %}
909
919
910
920
```scala
911
921
enum Planet(mass: Double, radius: Double):
@@ -927,7 +937,7 @@ enum Planet(mass: Double, radius: Double):
927
937
If you want to use Scala-defined enums as Java enums, you can do so by extending the class `java.lang.Enum` (which is imported by default) as follows:
928
938
929
939
{% tabs enum_6 %}
930
- {% tab 'Scala 3 only ' for=enum_6 %}
940
+ {% tab 'Scala 3 Only ' for=enum_6 %}
931
941
932
942
```scala
933
943
enum Color extends Enum[Color] { case Red, Green, Blue }
0 commit comments