From 1228f6497cf8141658695f07bbd807ba43be27e2 Mon Sep 17 00:00:00 2001 From: Miron Aseev Date: Sat, 20 Jul 2019 11:18:53 +0700 Subject: [PATCH] Remove the redundant 'val' and 'new' keywords --- _ba/tour/operators.md | 4 ++-- _ja/tour/operators.md | 4 ++-- _ru/tour/operators.md | 4 ++-- _tour/operators.md | 4 ++-- _zh-cn/tour/operators.md | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/_ba/tour/operators.md b/_ba/tour/operators.md index 363cf74858..1f68f621a7 100644 --- a/_ba/tour/operators.md +++ b/_ba/tour/operators.md @@ -29,8 +29,8 @@ Međutim, lakše je čitati kada se napiše kao infiksni operator: Možete koristiti bilo koji legalni identifikator kao operator. To uključuje i imena kao `add` ili simbole kao `+`. ```tut -case class Vec(val x: Double, val y: Double) { - def +(that: Vec) = new Vec(this.x + that.x, this.y + that.y) +case class Vec(x: Double, y: Double) { + def +(that: Vec) = Vec(this.x + that.x, this.y + that.y) } val vector1 = Vec(1.0, 1.0) diff --git a/_ja/tour/operators.md b/_ja/tour/operators.md index e6c2352ef2..f5b1ac6ed5 100644 --- a/_ja/tour/operators.md +++ b/_ja/tour/operators.md @@ -29,8 +29,8 @@ Scalaでは演算子はメソッドです。パラメータを1つだけ持つ 有効な識別子であれば演算子として使用できます。これは `add`のような名前も`+`のような記号も含みます。 ```tut -case class Vec(val x: Double, val y: Double) { - def +(that: Vec) = new Vec(this.x + that.x, this.y + that.y) +case class Vec(x: Double, y: Double) { + def +(that: Vec) = Vec(this.x + that.x, this.y + that.y) } val vector1 = Vec(1.0, 1.0) diff --git a/_ru/tour/operators.md b/_ru/tour/operators.md index 1609ce60f5..33b4cbfd20 100644 --- a/_ru/tour/operators.md +++ b/_ru/tour/operators.md @@ -26,8 +26,8 @@ prerequisite-knowledge: case-classes ## Создание и использование операторов В качестве оператора можно использовать любой допустимый символ. Включая имена на подобии `add` или символ (символы) типа `+`. ```tut -case class Vec(val x: Double, val y: Double) { - def +(that: Vec) = new Vec(this.x + that.x, this.y + that.y) +case class Vec(x: Double, y: Double) { + def +(that: Vec) = Vec(this.x + that.x, this.y + that.y) } val vector1 = Vec(1.0, 1.0) diff --git a/_tour/operators.md b/_tour/operators.md index b3ad662813..5744213cc0 100644 --- a/_tour/operators.md +++ b/_tour/operators.md @@ -26,8 +26,8 @@ However, it's easier to read as an infix operator: ## Defining and using operators You can use any legal identifier as an operator. This includes a name like `add` or a symbol(s) like `+`. ```tut -case class Vec(val x: Double, val y: Double) { - def +(that: Vec) = new Vec(this.x + that.x, this.y + that.y) +case class Vec(x: Double, y: Double) { + def +(that: Vec) = Vec(this.x + that.x, this.y + that.y) } val vector1 = Vec(1.0, 1.0) diff --git a/_zh-cn/tour/operators.md b/_zh-cn/tour/operators.md index c662d3a80c..dc42357bc8 100644 --- a/_zh-cn/tour/operators.md +++ b/_zh-cn/tour/operators.md @@ -26,8 +26,8 @@ previous-page: type-inference ## 定义和使用运算符 你可以使用任何合法标识符作为运算符。 包括像 `add` 这样的名字或像 `+` 这样的符号。 ```tut -case class Vec(val x: Double, val y: Double) { - def +(that: Vec) = new Vec(this.x + that.x, this.y + that.y) +case class Vec(x: Double, y: Double) { + def +(that: Vec) = Vec(this.x + that.x, this.y + that.y) } val vector1 = Vec(1.0, 1.0)