|
From: | GARY FORBIS |
Subject: | Switch inconsistancy |
Date: | Thu, 8 Jan 2009 04:33:33 +0000 |
Here's the test program: x='' if (strcmp(x,'')) printf ("equal\n") else printf("unequal\n") endif switch x case '' printf ("equal\n") otherwise printf ("unequal\n") endswitch x=" " if (strcmp(x," ")) printf ("equal\n") else printf("unequal\n") endif switch x case " " printf ("equal\n") otherwise printf ("unequal\n") endswitch Here's the output: x = equal unequal x = equal equal -------- I've gone ahead an purchased a license to MathLab. While I like the switch/endswitch construct better I don't like the results of the first switch statement where '' doesn't work as expected. MathLab produces the following: >> x=''; >> switch x case '' 'equal' otherwise 'unequal' end ans = equal |
[Prev in Thread] | Current Thread | [Next in Thread] |