Skip to content

Conversation

SteffenLm
Copy link
Contributor

No description provided.

SteffenLm and others added 4 commits August 19, 2023 14:20
* Update SchoolClass.java

In the loop condition, pupils.size() is re-evaluated in each iteration, and because the code removed pupils from the list inside the loop, the size of the list decreases with each iteration. This is not clean and because of this an exception occurred when trying to run the function with an even amount of pupils. 

Furthermore the if condition to check if the size of the array is 1 needed also to be inside the loop for this solution.

* Update Exercise.java

Add example for even pupils

* Use while loop

---------

Co-authored-by: SteffenLm <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants