Page 1 of 1

clist option similar to switch in c language

PostPosted: Fri Nov 07, 2008 3:57 pm
by var111
Hi All,

Can anybody tell me
Is there any clist parameter equivalent to Switch in c Language, through that we can put multiple conditions???

Thanks in advance.

Re: clist option similar to switch in c language

PostPosted: Sat Nov 08, 2008 2:51 am
by dick scherrer
Hello,

If you describe how you would use Switch (or how it operates), maybe someone can offer a rexx equivelent or workaround.

Re: clist option similar to switch in c language

PostPosted: Sat Nov 08, 2008 9:55 pm
by rajithr007
You can refer SELECT statement in CLIST it also present in REXX

Re: clist option similar to switch in c language

PostPosted: Sun Nov 09, 2008 12:38 am
by dick scherrer
Hello,

You can refer SELECT statement in CLIST it also present in REXX
How is this related to "switch" in the "c" programming language?

Clarification would be appreciated.

Re: clist option similar to switch in c language

PostPosted: Sun Nov 09, 2008 2:47 am
by rajithr007
Hi Dick,
Both Switch(in C) and SELECT(in Clist/Rexx) are used to avoid multiple IF-ELSE statement. i don’t say they are exactly same but they are similar
switch( expression )
     {
        case constant-expression1:   statements1;
        [case constant-expression2:   statements2;]   
        [case constant-expression3:   statements3;]
        [default : statements4;]
     }

SELECT [test expression]
              WHEN expression1 ...
                (action) ...
               WHEN expression2
               WHEN expression3
                [OTHERWISE] ...
               ( action) ...
END


When the test expression is used in the SELECT it is similar to SWITCH (with BREAK statement is used in all the CASE in switch)

Pls correct me if i am wrong..

Re: clist option similar to switch in c language

PostPosted: Sun Nov 09, 2008 3:33 am
by dick scherrer
Hi Rajith,

Thanks for the clarification :)

I don't speak "C" and had no idea what "switch" might accomplish :?

'Preciate it,

d

Re: clist option similar to switch in c language

PostPosted: Sun Nov 09, 2008 3:43 pm
by rajithr007
Hi Dick,

You are most welcome. :)

Regards
Rajith