Skip to content

How to update a while loop variable properly #946

Answered by hmzdot
onyedikachi-david asked this question in Q&A
Discussion options

You must be logged in to vote

Error says code can have usersPaid = 0 and InumUsers = 0 after the parallelReduce and in that case it would break the invariant of the while loop because you update the loop with [usersPaid + 1, InumUsers]

I suggest you to either make sure this scenario doesn't happen, or update you loop variables in such way

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@onyedikachi-david
Comment options

@hmzdot
Comment options

@onyedikachi-david
Comment options

Answer selected by jeapostrophe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants