Skip to content

Outcomes are 'None' or 'Inapplicable' for default rules #247

Discussion options

You must be logged in to vote

Thanks for reaching out! The issue you're seeing is related to the use of iterables. Some iterables, such as the one containing the outcomes, can only be iterated once while your code attempts to iterate it several times. On line 50, the iterable of outcomes is fully consumed to determine its size. Then, on line 57, the code attempts to iterate the iterable again once for every outcome, but at this point the iterable is actually empty. That's why you're seeing None returned every time the code attempts to read an outcome.

The easiest solution would be to instead use a for ... of loop to ensure that the iterable is only iterated once:

for (const outcome of outcomes) {
  console.log(outcome);

Replies: 12 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by kasperisager
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #247 on December 18, 2020 07:12.