0
Switch satement vs. for loop
Could the switch statement be seen as a specialized for loop?
4 Antworten
+ 3
No switch can be use to avoid writing multiple if else statement.
+ 1
That makes no sense. Yes it can be seen as alternate to if-else statements tho
0
G'day Joseph Edward Barry as the other have said, the 👉switch case() break👍 commands are not a loop.
However, I think 👉do while() continue break👍could be considered an alternative to a 👉for(;;;) continue break👍 loop.
Both check (condition) before looping again, both can have an increment that will meet the condition, both can continue or break, both should have an initialisation before running the loop.