+ 1
Switch or If-Else-Else if
I understand the difference between the two coding structures but is there a definite advantage of using one structure over the other in certain situations? If so, could someone give an example/details of one/two of these situations?
4 Antworten
+ 1
for smaller number of comparisons it doesn't matter what you use but for large comparisons switch is better, additionally switch improves the readability of your code and you can do some neat tricks by omitting the break statements for cases you want to execute together.
+ 6
Some good information 💖💕🙌🤗
https://www.sololearn.com/learn/Java/2145/
https://www.sololearn.com/learn/Java/2205/
0
@NimWing Yuan
The links you provide seem to be pages that are missing