Skip to content

Commit ebff885

Browse files
authored
Make scan and runningFold documentation example consistent with other operators (#3571)
Fixes #3567
1 parent c3b7b20 commit ebff885

File tree

1 file changed

+2
-2
lines changed
  • kotlinx-coroutines-core/common/src/flow/operators

1 file changed

+2
-2
lines changed

kotlinx-coroutines-core/common/src/flow/operators/Transform.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public fun <T> Flow<T>.onEach(action: suspend (T) -> Unit): Flow<T> = transform
8787
* ```
8888
* flowOf(1, 2, 3).scan(emptyList<Int>()) { acc, value -> acc + value }.toList()
8989
* ```
90-
* will produce `[], [1], [1, 2], [1, 2, 3]`.
90+
* will produce `[[], [1], [1, 2], [1, 2, 3]]`.
9191
*
9292
* This function is an alias to [runningFold] operator.
9393
*/
@@ -100,7 +100,7 @@ public fun <T, R> Flow<T>.scan(initial: R, @BuilderInference operation: suspend
100100
* ```
101101
* flowOf(1, 2, 3).runningFold(emptyList<Int>()) { acc, value -> acc + value }.toList()
102102
* ```
103-
* will produce `[], [1], [1, 2], [1, 2, 3]`.
103+
* will produce `[[], [1], [1, 2], [1, 2, 3]]`.
104104
*/
105105
public fun <T, R> Flow<T>.runningFold(initial: R, @BuilderInference operation: suspend (accumulator: R, value: T) -> R): Flow<R> = flow {
106106
var accumulator: R = initial

0 commit comments

Comments
 (0)