|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
| View Poll Results: Which is better - switch case or if?? | |||
| switch case | | 1 | 50.00% |
| if | | 1 | 50.00% |
| Voters: 2. You may not vote on this poll | |||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
|
|
#2
|
|||
|
|||
|
I think it depends.
I have used both of these, and I really believe it depends on the application.
Example. If I have a program that asks me to choose a number to perform an operation. Like: choose 1 - to open this file. choose 2 - to save the file. ect... then I would use the case statement, but if I had a situation where I wanted to check to see if something was null. Like if( name = null) dosomething. I would use the if statement. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > Java Development > Which is better to use as a developer: switch case or if?? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|