Skip to content

Commit 1228f64

Browse files
committed
Remove the redundant 'val' and 'new' keywords
1 parent 12d9212 commit 1228f64

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

_ba/tour/operators.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ Međutim, lakše je čitati kada se napiše kao infiksni operator:
2929
Možete koristiti bilo koji legalni identifikator kao operator.
3030
To uključuje i imena kao `add` ili simbole kao `+`.
3131
```tut
32-
case class Vec(val x: Double, val y: Double) {
33-
def +(that: Vec) = new Vec(this.x + that.x, this.y + that.y)
32+
case class Vec(x: Double, y: Double) {
33+
def +(that: Vec) = Vec(this.x + that.x, this.y + that.y)
3434
}
3535
3636
val vector1 = Vec(1.0, 1.0)

_ja/tour/operators.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ Scalaでは演算子はメソッドです。パラメータを1つだけ持つ
2929

3030
有効な識別子であれば演算子として使用できます。これは `add`のような名前も`+`のような記号も含みます。
3131
```tut
32-
case class Vec(val x: Double, val y: Double) {
33-
def +(that: Vec) = new Vec(this.x + that.x, this.y + that.y)
32+
case class Vec(x: Double, y: Double) {
33+
def +(that: Vec) = Vec(this.x + that.x, this.y + that.y)
3434
}
3535
3636
val vector1 = Vec(1.0, 1.0)

_ru/tour/operators.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ prerequisite-knowledge: case-classes
2626
## Создание и использование операторов
2727
В качестве оператора можно использовать любой допустимый символ. Включая имена на подобии `add` или символ (символы) типа `+`.
2828
```tut
29-
case class Vec(val x: Double, val y: Double) {
30-
def +(that: Vec) = new Vec(this.x + that.x, this.y + that.y)
29+
case class Vec(x: Double, y: Double) {
30+
def +(that: Vec) = Vec(this.x + that.x, this.y + that.y)
3131
}
3232
3333
val vector1 = Vec(1.0, 1.0)

_tour/operators.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ However, it's easier to read as an infix operator:
2626
## Defining and using operators
2727
You can use any legal identifier as an operator. This includes a name like `add` or a symbol(s) like `+`.
2828
```tut
29-
case class Vec(val x: Double, val y: Double) {
30-
def +(that: Vec) = new Vec(this.x + that.x, this.y + that.y)
29+
case class Vec(x: Double, y: Double) {
30+
def +(that: Vec) = Vec(this.x + that.x, this.y + that.y)
3131
}
3232
3333
val vector1 = Vec(1.0, 1.0)

_zh-cn/tour/operators.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ previous-page: type-inference
2626
## 定义和使用运算符
2727
你可以使用任何合法标识符作为运算符。 包括像 `add` 这样的名字或像 `+` 这样的符号。
2828
```tut
29-
case class Vec(val x: Double, val y: Double) {
30-
def +(that: Vec) = new Vec(this.x + that.x, this.y + that.y)
29+
case class Vec(x: Double, y: Double) {
30+
def +(that: Vec) = Vec(this.x + that.x, this.y + that.y)
3131
}
3232
3333
val vector1 = Vec(1.0, 1.0)

0 commit comments

Comments
 (0)