help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Switch inconsistancy


From: Jaroslav Hajek
Subject: Re: Switch inconsistancy
Date: Thu, 8 Jan 2009 07:15:15 +0100

On Thu, Jan 8, 2009 at 5:33 AM, GARY FORBIS <address@hidden> 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
> address@hidden
> 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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]