Skip to content

Commit cd75114

Browse files
committed
fix: ids for runnable samples
1 parent c51c535 commit cd75114

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

docs/topics/functions.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,19 +105,22 @@ fun main () {
105105
since the last parameter must correspond to the passed function:
106106

107107
```kotlin
108+
fun main () {
109+
//sampleStart
108110
fun foo(
109111
foo: Int = 0,
110112
bar: () -> Unit,
111113
)
112114
{ println(foo)
113115
bar() }
114116

115-
fun main () {
116-
// Prints the default value 0 for 'foo', then prints "bar"
117-
foo() { println ("bar") }
117+
118+
// Prints the default value 0 for 'foo', then prints "bar"
119+
foo() { println ("bar") }
120+
//sampleEnd
118121
}
119122
```
120-
{kotlin-runnable="true" kotlin-min-compiler-version="1.3"}
123+
{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="default-before-trailing-lambda"}
121124

122125
[Overriding methods](inheritance.md#overriding-methods) always use the base method's default parameter values.
123126
When overriding a method that has default parameter values, you must omit the default parameter values from the signature:
@@ -171,7 +174,7 @@ read (1, null)
171174
//sampleEnd
172175
}
173176
```
174-
{kotlin-runnable="true" kotlin-min-compiler-version="1.3"}
177+
{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="non-constant-default"}
175178

176179
If the last parameter in a function declaration has a functional type,
177180
you can pass the corresponding [lambda](lambdas.md#lambda-expression-syntax) argument either as a named argument or [outside the parentheses](lambdas.md#passing-trailing-lambdas):
@@ -198,7 +201,7 @@ foo { println("hello") }
198201
//sampleEnd
199202
}
200203
```
201-
{kotlin-runnable="true" kotlin-min-compiler-version="1.3"}
204+
{kotlin-runnable="true" kotlin-min-compiler-version="1.3" id="lambda-outside-parentheses"}
202205

203206
### Named arguments
204207

0 commit comments

Comments
 (0)