You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
printName(first ="John", last ="Smith") // Prints "John Smith"
28
-
printName(last ="Smith", first ="John") // Prints "John Smith"
29
-
```
30
-
{% endtab %}
31
-
32
-
{% tab 'Scala 3' for=named-arguments-when-good %}
20
+
{% tab 'Scala 2 and 3' for=named-arguments-when-good %}
33
21
```scala mdoc
34
22
defprintName(first: String, last: String):Unit=
35
23
println(first +""+ last)
@@ -44,7 +32,7 @@ printName(last = "Smith", first = "John") // Prints "John Smith"
44
32
45
33
Notice how the order of named arguments can be rearranged. However, if some arguments are named and others are not, the unnamed arguments must come first and in the order of their parameters in the method signature.
46
34
47
-
{% tabs scala-2-and-3-demo %}
35
+
{% tabs named-arguments-when-error %}
48
36
49
37
{% tab 'Scala 2 and 3' for=named-arguments-when-error %}
0 commit comments