Ask Your Question

Why is every instance in the switch case being executed during a for loop?

asked 2022-05-24 11:00:00 +0000

djk gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2022-09-08 18:00:00 +0000

david gravatar image

It is possible that the switch case is inside a loop that is being executed for each iteration. This would cause the code to execute every instance in the switch case for each iteration of the loop. Another possibility is that the conditions for each case are being met multiple times during the loop, causing multiple executions of the code within each case. It is important to carefully examine the logic of the code to determine why this is happening.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer

Question Tools


Asked: 2022-05-24 11:00:00 +0000

Seen: 16 times

Last updated: Sep 08 '22