Okay a few months ago I was working on a 5 card poker game and ran into a game breaking bug. Finally decided to come back to it and fix it and clean it up. While cleaning it up a came across this set of if greater than statements which I feel should be cleaned up but I am not sure how to do so. Is there a way to use a switch statement to check if scored[i] does not equal 0?(scored[i] can never be less than 0)
scored[i] and highCard are both integers and have been declared and set.
joseph Anderson wrote:That is actually a good idea but i think i figured it out
Is the logic correct here?
edit: as in does it mean the same thing as the above code
edit2: got a lot of responses while i was looking a ways of condensing it.
The logic is not the same as your original post. In your original post you test the values in descending order, not ascending as you have here. You also need a break statement to avoid additional tests once a value greater than zero is found.