Skip to content

Commit 40a01fb

Browse files
committed
docs: revised according to review.
1 parent bb0f28a commit 40a01fb

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

examples/06_productivity_boosters/01_namedArguments.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Named Arguments
22

3-
As most of programming languages (Java, C++, and other), Kotlin supports passing arguments to methods and constructors according to their order of definition.
4-
Kotlin also supports [named arguments](https://kotlinlang.org/docs/reference/functions.html#named-arguments) to allow clearer invocations and avoid mistakes in arguments order. Such mistakes are hard to find because they are not detected by the compiler, for example, if two sequential arguments have the same type.
3+
As with most other programming languages (Java, C++, etc.), Kotlin supports passing arguments to methods and constructors according to the order they are defined.
4+
Kotlin also supports [named arguments](https://kotlinlang.org/docs/reference/functions.html#named-arguments) to allow clearer invocations and avoid mistakes with the order of arguments. Such mistakes are hard to find because they are not detected by the compiler, for example, when two sequential arguments have the same type.
55
<div class="language-kotlin" theme="idea" data-min-compiler-version="1.3">
66

77
```kotlin
@@ -19,7 +19,7 @@ fun main() {
1919

2020
</div>
2121

22-
1. Calling a function with argument values.
23-
2. Calling a function with switched arguments. No syntax errors, but the result _domain.com@username_ is incorrect.
24-
3. Calling a function with named arguments.
22+
1. Calls a function with argument values.
23+
2. Calls a function with switched arguments. No syntax errors, but the result _domain.com@username_ is incorrect.
24+
3. Calls a function with named arguments.
2525
4. When invoking a function with named arguments, you can specify them in any order you like.

examples/06_productivity_boosters/02_String Templates.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ fun main() {
1616

1717
</div>
1818

19-
1. Printing a string with a variable reference. References in strings start with `$`.
20-
2. Printing a string with an expression. Expressions start with `$` and are enclosed in curly braces.
19+
1. Prints a string with a variable reference. References in strings start with `$`.
20+
2. Prints a string with an expression. Expressions start with `$` and are enclosed in curly braces.
2121

examples/06_productivity_boosters/03_Destructuring Declarations.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Destructuring Declarations
22

3-
[Destructuring declaration](https://kotlinlang.org/docs/reference/multi-declarations.html#destructuring-declarations) syntax can be very handy when you need an instance only for accessing its members. It lets you define the instance without a specific name therefore saving a few lines of code.
3+
[Destructuring declaration](https://kotlinlang.org/docs/reference/multi-declarations.html#destructuring-declarations) syntax can be very handy, especially when you need an instance only for accessing its members. It lets you define the instance without a specific name therefore saving a few lines of code.
44

55
<div class="language-kotlin" theme="idea" data-min-compiler-version="1.3">
66

@@ -27,7 +27,7 @@ fun main() {
2727

2828
</div>
2929

30-
1. Destructuring an `Array`. The number of variables on the left side matches the number of arguments on the right side.
30+
1. Destructures an `Array`. The number of variables on the left side matches the number of arguments on the right side.
3131
2. Maps can be destructured as well. `name` and `age` variables are mapped to the map key and value.
3232
3. Built-in `Pair` and `Triple` types support destructuring too, even as return values from functions.
3333

@@ -50,8 +50,8 @@ fun main() {
5050

5151
</div>
5252

53-
1. Defining a data class.
54-
2. Destructuring an instance. Declared values are mapped to the instance fields.
53+
1. Defines a data class.
54+
2. Destructures an instance. Declared values are mapped to the instance fields.
5555
3. Data class automatically defines the `component1()` and `component2()` methods that will be called during destructuring.
5656
4. Use _underscore_ if you don't need one of the values, avoiding the compiler hint indicating an unused variable.
5757

@@ -77,5 +77,5 @@ fun main() {
7777

7878
</div>
7979

80-
1. Defining a custom `Pair` class with `component1()` and `component2()` methods.
81-
2. Destructuring an instance of this class is same as for built-in `Pair`.
80+
1. Defines a custom `Pair` class with `component1()` and `component2()` methods.
81+
2. Destructures an instance of this class the same way as for built-in `Pair`.

examples/06_productivity_boosters/04_Smart Casts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ fun main() {
3838

3939
</div>
4040

41-
1. Declaring a nullable variable.
41+
1. Declares a nullable variable.
4242
2. Smart-cast to non-nullable (thus allowing direct access to `isLeapYear`).
4343
3. Smart-cast inside a condition (this is possible because, like Java, Kotlin uses [short-circuiting](https://en.wikipedia.org/wiki/Short-circuit_evaluation)).
4444
4. Smart-cast inside acondition (also enabled by short-circuiting).

0 commit comments

Comments
 (0)