bintin Posted February 21, 2013 Author Share Posted February 21, 2013 So do If statements and case statements do the same thing? I'm learning C# and it appears that they do but why? there must be something different about them, can anyone explain the differences between if and case statements? please.. Link to comment Share on other sites More sharing options...
Mal Posted February 22, 2013 Share Posted February 22, 2013 This site explains it pretty thoroughly: [http://stackoverflow…else-and-switch](http://stackoverflow.com/questions/680656/what-is-the-difference-between-if-else-and-switch)Summation: Use a Switch if you're using primitive data types and simple condition expressions (e.g., does this constant match this value?). Use If/Else if you need to use complex condition expressions with user-defined types. Link to comment Share on other sites More sharing options...
bintin Posted February 22, 2013 Author Share Posted February 22, 2013 Thank you, makes more sense now. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now