mirror of
https://github.com/dlang/phobos.git
synced 2025-05-08 03:56:54 +03:00
walkBack follow-up: Mention fold's potential in the examples
This commit is contained in:
parent
8b4f16182d
commit
0f7952c4d8
1 changed files with 3 additions and 0 deletions
|
@ -3206,6 +3206,9 @@ if (fun.length >= 1)
|
|||
|
||||
// Can be used in a UFCS chain
|
||||
assert(arr.map!(a => a + 1).fold!((a, b) => a + b) == 20);
|
||||
|
||||
// Return the last element of any range
|
||||
assert(arr.fold!((a, b) => b) == 5);
|
||||
}
|
||||
|
||||
@safe @nogc pure nothrow unittest
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue