0
Is it a bad habbit to have too many if-else statement in my code?
I'm a coding noob in C#, I just found I've used too many if-else statements in my code. The readability of the code is so bad. Is there a way to avoid using the if-else statement while maintaining readability?
3 odpowiedzi
+ 2
If you feel you have too many, you can always use something called a switch-statement.
Here's a good source for how to use them in C#: https://www.geeksforgeeks.org/switch-statement-in-c-sharp/
+ 2
Share your code bit link so people can review it to see, whether it is as you said - has too many branches.
https://www.sololearn.com/post/75089/?ref=app
+ 2
Yasswecancn
Switch statement is an alternative solution of multiple if else condition.
And it will be more readable than multiple if else