Christophe Grandsire wrote:
> Selon Robert Klemme <bob.news / gmx.net>:
>
>>
>> Just out of curiosity: which languages are you referring to and what
>> do they do?
>>
>
> The only languages I've ever used that I know have a switch/case
> statement are Pascal, C and LINC (a database-related language from
> Unisys). AFAIK, in all those cases the case statements are equivalent
> to using an if/elsif/else construction, with the expression
> introduced by the switch/case being at the *left* of the equal sign,
> and the different possibilities at the right. It is especially true
> of LINC, where the case statement can only introduce a variable,
> while the different choices can be literals (and literals in LINC
> can't be at the left of a condition expression).

Interesting to learn.  Note however, that - if my rusty PASCAL doesn't
fool me - for PASCAL and C only scalar types are allowed for cases and
equality is commutative for these.  So the convention having the var at
the left side in the if/else cascade may only because it reads more
natural for humans but it may actually have no meaning with respect to
language implementation (and it doesn't even change the semantics in these
cases).  Note also that the if/else can become quite complex for C because
of fallthrough.

I don't know LINC but from what you say it sounds as if it's actually
different there.

>>> Wow! Some of the things one can do with Ruby make my head spin! The
>>> worst is: I can understand what it means!!! ;)
>>
>> Pity you... :-))
>
> When I see this kind of programs, I always think: there's just no way
> I should be able to understand this! I am whether completely wrong in
> my understanding, or getting insane! (you have to realise I've never
> had true IT or CS education in my entire life)

Then you probably get it from Ruby... :-)  Seriously, it doesn't hurt to
read through some good books on algorithms and data structures to
understand why a Hash is more efficient than an Array in certain scenarios
etc.

>> Ok, print this out in a bold 64pt font "I must never forget that in
>> a CASE statement conditions have their === invoked." :-)
>
> It will get lost in the moving (I'm moving within a month). But I'll
> keep this post, for security :) .

I was just going to offer to repost it... :-)))

Kind regards

    robert