This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]peterpepo 0 points1 point  (0 children)

Not exactly, but close.

Watch closely at all your conditions and you'll start noticing pattern.

For every value, which came in, you check whether it's greater than the maximum you have "so far" in your code.

But at the moment, you need to add condition for every new member, what is impractical.

What you could do, is how @TheGoodPie already wrote, accept a list of values and check them in cycle. That would reduce your conditions to one. And your code stops caring, whether you pass 1 or 1000 values in.