General information
Category:
Coding, syntax and commands
>>>>Why in the world must a switch statement need an integer???
>>>>
>>>>Other languages are much more flexible in their CASE structures, so why would MS restrict the evaluation of the switch to an int????
>>>
>>>See Naomi's answer, but also be aware:
>>>
>>>If your trying to compare a switch statement to a VFP "DO CASE", they are very different. To write a VFP style case statement in C# use "else if" .
>>
>>Very different how? To me they seem quite similar. They are both structured as a series of checks of some value. When a match is found, take some action and exit. Both provide for a default action if no match is found.
>
>In VFP DO CASE you can put any condition, even function evaluation. In C# switch you analyze one variable.
Yes, I know. But there still seem to be a lot more similarities than differences. The C# approach is cleaner (IMO) but not as flexible.
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only