Hi Rafael

Interesting... So I don't need to select anything, I can just do case model== something. (Or maybe select initializes the case ... but it looks to me like you're not really using select for anything)

/Claus

On 22-01-2017 19:18, Rafael Guerra wrote:

**Schlumberger-Private**

Hi Claus,

Check this code out:

/// START OF (UGLY) CASE/

loop=%t;

whileloop

printf("\n")

str = _input_("Enter number (1-7) or 0 to exit: n=","string");

n = _evstr_(str);

select %t

case n== 2

printf("single choice...\n");

case n== 5

printf("single choice...\n");

case or(n==[1 3 4])

printf("n=%i --> multiple choice#1:\n",n);

caseor(n==[6,7])

printf("n=%i --> multiple choice#2:\n",n);

case n==0

printf("Bye...\n");

loop=%f;

end

end

/// END OF CASE/

Regards,

Rafael

-----Original Message-----
From: users [mailto:[email protected]] On Behalf Of Claus Futtrup
Sent: Sunday, January 22, 2017 3:59 PM
To: International users mailing list for Scilab. <[email protected]>
Subject: [Scilab-users] case control statement

Hi there

I'd like to use the "case" control statement to select a few options.

I'm wondering, is it possible for a case to have multiple options, I

mean like this:

select model

case 1,3,4 then

do something

case 2 then

do something

case 5 then

do something

end

Could I define [1 3 4] as a group of options and ask "CASE IN GROUP" ...

or how would I go about and implement this?

Best regards,

Claus



_______________________________________________
users mailing list
[email protected]
http://lists.scilab.org/mailman/listinfo/users


_______________________________________________
users mailing list
[email protected]
http://lists.scilab.org/mailman/listinfo/users

Reply via email to