Skip to content

Commit d6aa71d

Browse files
committed
correct 2&3 and 3 only tab.
1 parent 62e554e commit d6aa71d

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

_overviews/scala3-book/methods-most.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ In that syntax:
5959
Here are two examples of a one-line method named `add` that takes two `Int` input parameters.
6060
The first version explicitly shows the method’s `Int` return type, and the second does not:
6161

62-
{% tabs method_2 class=tabs-scala-version %}
62+
{% tabs method_2 %}
6363
{% tab 'Scala 2 and 3' for=method_2 %}
6464

6565
```scala
@@ -77,7 +77,7 @@ Declaring the return type can make it easier to understand it when you look at i
7777

7878
Invoking a method is straightforward:
7979

80-
{% tabs method_3 class=tabs-scala-version %}
80+
{% tabs method_3 %}
8181
{% tab 'Scala 2 and 3' for=method_3 %}
8282

8383
```scala
@@ -90,7 +90,7 @@ val x = add(1, 2) // 3
9090
The Scala collections classes have dozens of built-in methods.
9191
These examples show how to call them:
9292

93-
{% tabs method_4 class=tabs-scala-version %}
93+
{% tabs method_4 %}
9494
{% tab 'Scala 2 and 3' for=method_4 %}
9595

9696
```scala
@@ -146,7 +146,7 @@ In that method:
146146

147147
When you paste that code into the REPL, you’ll see that it works as desired:
148148

149-
{% tabs method_6 class=tabs-scala-version %}
149+
{% tabs method_6 %}
150150
{% tab 'Scala 2 and 3' for=method_6 %}
151151

152152
```scala
@@ -162,7 +162,7 @@ Because almost everything in Scala is an _expression_---meaning that each line o
162162

163163
This becomes more clear when you condense that method and write it on one line:
164164

165-
{% tabs method_7 class=tabs-scala-version %}
165+
{% tabs method_7 %}
166166
{% tab 'Scala 2 and 3' for=method_7 %}
167167

168168
```scala
@@ -245,7 +245,7 @@ def makeConnection(timeout: Int = 5_000, protocol: String = "http") =
245245

246246
Because the parameters have default values, the method can be called in these ways:
247247

248-
{% tabs method_10 class=tabs-scala-version %}
248+
{% tabs method_10 %}
249249
{% tab 'Scala 2 and 3' for=method_10 %}
250250

251251
```scala
@@ -270,7 +270,7 @@ Notice that by using default parameter values, it appears to the consumer that t
270270
If you prefer, you can also use the names of the method parameters when calling a method.
271271
For instance, `makeConnection` can also be called in these ways:
272272

273-
{% tabs method_11 class=tabs-scala-version %}
273+
{% tabs method_11 %}
274274
{% tab 'Scala 2 and 3' for=method_11 %}
275275

276276
```scala
@@ -286,7 +286,7 @@ makeConnection(protocol="https", timeout=10_000)
286286
In some frameworks named parameters are heavily used.
287287
They’re also very useful when multiple method parameters have the same type:
288288

289-
{% tabs method_12 class=tabs-scala-version %}
289+
{% tabs method_12 %}
290290
{% tab 'Scala 2 and 3' for=method_12 %}
291291

292292
```scala
@@ -298,7 +298,7 @@ engage(true, true, true, false)
298298

299299
Without help from an IDE that code can be hard to read, but this code is much more clear and obvious:
300300

301-
{% tabs method_13 class=tabs-scala-version %}
301+
{% tabs method_13 %}
302302
{% tab 'Scala 2 and 3' for=method_13 %}
303303

304304
```scala
@@ -324,7 +324,7 @@ When you create arity-0 methods:
324324

325325
For example, this method performs a side effect, so it’s declared with empty parentheses:
326326

327-
{% tabs method_14 class=tabs-scala-version %}
327+
{% tabs method_14 %}
328328
{% tab 'Scala 2 and 3' for=method_14 %}
329329

330330
```scala
@@ -336,7 +336,7 @@ def speak() = println("hi")
336336

337337
Doing this requires callers of the method to use open parentheses when calling the method:
338338

339-
{% tabs method_15 class=tabs-scala-version %}
339+
{% tabs method_15 %}
340340
{% tab 'Scala 2 and 3' for=method_15 %}
341341

342342
```scala
@@ -387,7 +387,7 @@ def isTruthy(a: Any) =
387387

388388
These examples show how that method works:
389389

390-
{% tabs method_17 class=tabs-scala-version %}
390+
{% tabs method_17 %}
391391
{% tab 'Scala 2 and 3' for=method_17 %}
392392

393393
```scala
@@ -624,7 +624,7 @@ Their main purpose is to let you add new functionality to closed classes.
624624
As shown in that section, imagine that you have a `Circle` class, but you can’t change its source code.
625625
For instance, it may be defined like this in a third-party library:
626626

627-
{% tabs method_23 class=tabs-scala-version %}
627+
{% tabs method_23 %}
628628
{% tab 'Scala 2 and 3' for=method_23 %}
629629

630630
```scala
@@ -636,7 +636,7 @@ case class Circle(x: Double, y: Double, radius: Double)
636636

637637
When you want to add methods to this class, you can define them as extension methods, like this:
638638

639-
{% tabs method_24 class=tabs-scala-version %}
639+
{% tabs method_24 %}
640640
{% tab 'Scala 3 only' for=method_24 %}
641641

642642
```scala
@@ -651,7 +651,7 @@ extension (c: Circle)
651651

652652
Now when you have a `Circle` instance named `aCircle`, you can call those methods like this:
653653

654-
{% tabs method_25 class=tabs-scala-version %}
654+
{% tabs method_25 %}
655655
{% tab 'Scala 2 and 3' for=method_25 %}
656656

657657
```scala

0 commit comments

Comments
 (0)