Skip to content

Commit c411d4a

Browse files
authored
Update comment in example code (#2500)
* Update comment in example code Help clarify that x is set to 1, and y is set to default value. This comment is more explicit in what x and y are set to. * Update Scala 3 code snippet. Update Scala 3 code snippet to include more descriptive comment.
1 parent b0197ae commit c411d4a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

_tour/classes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Constructors can have optional parameters by providing a default value like so:
101101
class Point(var x: Int = 0, var y: Int = 0)
102102

103103
val origin = new Point // x and y are both set to 0
104-
val point1 = new Point(1) // y is set to 0
104+
val point1 = new Point(1) // x is set to 1 and y is set to 0
105105
println(point1) // prints (1, 0)
106106
```
107107
{% endtab %}
@@ -111,7 +111,7 @@ println(point1) // prints (1, 0)
111111
class Point(var x: Int = 0, var y: Int = 0)
112112

113113
val origin = Point() // x and y are both set to 0
114-
val point1 = Point(1) // y is set to 0
114+
val point1 = Point(1) // x is set to 1 and y is set to 0
115115
println(point1) // prints (1, 0)
116116
```
117117
{% endtab %}

0 commit comments

Comments
 (0)