Skip to content

Commit cfd2052

Browse files
authored
Docs: Fix the logic in FizzBuzz WorkChain example (aiidateam#6812)
Fix a few mistakes of the `FizzBuzz` example in `docs/source/topics/workflows/usage.rst`
1 parent ee1cc9f commit cfd2052

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

docs/source/topics/workflows/usage.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -215,19 +215,19 @@ The following example shows how to use these logical constructs to define the ou
215215
.. code:: python
216216
217217
spec.outline(
218-
cls.intialize_to_zero,
218+
cls.initialize_to_zero,
219219
while_(cls.n_is_less_than_hundred)(
220-
if_(cls.n_is_multitple_of_three)(
220+
if_(cls.n_is_multiple_of_three_and_five)(
221+
cls.report_fizz_buzz,
222+
).elif_(cls.n_is_multiple_of_three)(
221223
cls.report_fizz,
222224
).elif_(cls.n_is_multiple_of_five)(
223225
cls.report_buzz,
224-
).elif_(cls.n_is_multiple_of_three_and_five)(
225-
cls.report_fizz_buzz,
226226
).else_(
227227
cls.report_n,
228-
)
228+
),
229+
cls.increment_n_by_one,
229230
),
230-
cls.increment_n_by_one,
231231
)
232232
233233
This is an implementation (and an extremely contrived one at that) of the well known FizzBuzz [#f2]_ problem.
@@ -239,7 +239,7 @@ The actual implementation of the outline steps themselves is now trivial:
239239
.. code:: python
240240
241241
def initialize_to_zero(self):
242-
self.ctx.n = 0
242+
self.ctx.n = 1
243243
244244
def n_is_less_than_hundred(self):
245245
return self.ctx.n < 100

0 commit comments

Comments
 (0)