Switch inconsistancy
Jaroslav Hajek
highegg at gmail.com
Thu Jan 8 00:15:15 CST 2009
On Thu, Jan 8, 2009 at 5:33 AM, GARY FORBIS <forbisgaryg at msn.com> wrote:
> 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
>
>
> _______________________________________________
> Help-octave mailing list
> Help-octave at octave.org
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>
>
IIRC this is fixed in both development branch and release-3-0-x
regards
--
RNDr. Jaroslav Hajek
computing expert
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz
More information about the Help-octave
mailing list