diff --git a/components/console/helpers/progressbar.rst b/components/console/helpers/progressbar.rst index 0cb53bbbd43..f13946591f5 100644 --- a/components/console/helpers/progressbar.rst +++ b/components/console/helpers/progressbar.rst @@ -110,11 +110,17 @@ which starts, advances and finishes the progress bar automatically:: $progressBar = new ProgressBar($output); - // $iterable can be for example an array ([1, 2, 3, ...]) or a generator - // $iterable = function () { yield 1; yield 2; ... }; + // $iterable can be for example an array ([1, 2, 3, ...]) + $iterable = [1, 2]; foreach ($progressBar->iterate($iterable) as $value) { // ... do some work } + + // or a generator + function iterable() { yield 1; yield 2; ... }; + foreach ($progressBar->iterate(iterable()) as $value) { + // ... do some work + } If ``$iterable = [1, 2]``, the previous code will output the following: