You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Copy file name to clipboardExpand all lines: examples/06_productivity_boosters/02_String Templates.md
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,6 @@
1
1
# String Templates
2
2
3
+
[String templates](https://kotlinlang.org/docs/reference/basic-types.html#string-templates) allow you to include variable references and expressions into strings. When the value of a string is requested (for example, by `println`), all references and expressions are substituted with actual values.
Copy file name to clipboardExpand all lines: examples/06_productivity_boosters/03_Destructuring Declarations.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Destructuring Declarations
2
2
3
-
_Destructuring declaration_ syntax can be very handy and save you 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.
2. Smart-cast to non-nullable (thus allowing direct access to `isLeapYear`).
43
+
3. Smart-cast inside a condition (this is possible because, like Java, Kotlin uses [short-circuiting](https://en.wikipedia.org/wiki/Short-circuit_evaluation)).
44
+
4. Smart-cast inside acondition (also enabled by short-circuiting).
45
+
5. Smart-cast to the subtype `LocalDate`.
41
46
42
-
1. Declares a nullable variable
43
-
2. Smart-cast to non-nullable (thus allowing direct access to `isLeapYear`)
44
-
3. Smart-cast inside condition (this is possible because, like Java, Kotlin uses [short-circuiting](https://en.wikipedia.org/wiki/Short-circuit_evaluation))
45
-
4. Smart-cast inside condition (also enabled by short-circuiting)
46
-
5. Smart-cast to subtype LocalDate
47
-
48
-
This way, you can automatically use variables as desired most of the time without doing obvious casts manually.
47
+
This way, you can automatically use variables as desired in most cases without doing obvious casts manually.
0 commit comments