Schlumberger-Private Well, it selects only %true expressions, actually I believe it selects only the first case true expression encountered, so the cases need to be exclusive. You can test and let us know
From: users [mailto:[email protected]] On Behalf Of Claus Futtrup Sent: Sunday, January 22, 2017 7:31 PM To: [email protected] Subject: Re: [Scilab-users] case control statement 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; while loop 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); case or(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]><mailto:[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]<mailto:[email protected]> http://lists.scilab.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.scilab.org/mailman/listinfo/users
