Skip to content

Commit 95d88ab

Browse files
committed
Fix samples in Flow docs
1 parent fd0428e commit 95d88ab

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
@@ -80,7 +80,7 @@ public fun <T> Flow<T>.onEach(action: suspend (T) -> Unit): Flow<T> = transform
8080
* Note that initial value should be immutable (or should not be mutated) as it is shared between different collectors.
8181
* For example:
8282
* ```
83-
* flowOf(1, 2, 3).accumulate(emptyList<Int>()) { acc, value -> acc + value }.toList()
83+
* flowOf(1, 2, 3).scan(emptyList<Int>()) { acc, value -> acc + value }.toList()
8484
* ```
8585
* will produce `[], [1], [1, 2], [1, 2, 3]]`.
8686
*/
@@ -101,7 +101,7 @@ public fun <T, R> Flow<T>.scan(initial: R, @BuilderInference operation: suspend
101101
*
102102
* For example:
103103
* ```
104-
* flowOf(1, 2, 3, 4).scan { (v1, v2) -> v1 + v2 }.toList()
104+
* flowOf(1, 2, 3, 4).scanReduce { (v1, v2) -> v1 + v2 }.toList()
105105
* ```
106106
* will produce `[1, 3, 6, 10]`
107107
*/

0 commit comments

Comments
 (0)