Skip to content

Commit 7abf532

Browse files
committed
update: runnable sample
1 parent bd3a59d commit 7abf532

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

docs/topics/functions.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,19 @@ If a parameter with default value precedes a parameter with no default value, th
6464
the function with [named arguments](#named-arguments):
6565

6666
```kotlin
67+
fun main () {
68+
//sampleStart
6769
fun foo(
6870
foo: Int = 0,
6971
bar: Int,
7072
) { /*...*/ }
7173

7274
foo(bar = 1) // Uses the default value foo = 0
7375
foo(1) // Error: No value passed for parameter 'bar'
76+
//sampleEnd
77+
}
7478
```
79+
{kotlin-runnable="true" kotlin-min-compiler-version="1.3"}
7580

7681
[Overriding methods](inheritance.md#overriding-methods) always use the base method's default parameter values.
7782
When overriding a method that has default parameter values, the default parameter values must be omitted from the signature:

0 commit comments

Comments
 (0)