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]>
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

Reply via email to