[Scilab-users] Booeleans : irrelevant results ?

Carrico, Paul paul.carrico at esterline.com
Thu Aug 27 12:29:43 CEST 2015


Dear All,

I wondering what I'm doing wrong in the examples here bellow:

-          Test 1 --> M returns False that's ok for me

-          Test 2 --> should return False as well, shouldn't be ?

-          Test 3 --> another test using directly a Boolean instead of an empty form []

-          Test 4 --> as expected, it returns F

Thanks for any highlight

Paul

##############################################################################"
mode(0)

// test 1
M = [];
if M then
    printf("M returns T\n");
else
    printf("M returns F\n");
end

// test 2
a=[];
b=30;
c=200;

if (b & c & a) then
    printf("val = 6\n");
    else printf("val = []\n"); // should return [] ??????
end

// test 3
tmp = %f;
//tmp = %t;

if (tmp) then
    printf("tmp returns T\n");
else
    printf("tmp returns F\n");
end

// test 4
t1 = %t;
t2 = %t;
//t3 = %t;
t3 = %f;

if (t1 & t2 & t3) then
    printf("(t1,t2,t3) returns T\n");
else
    printf("(t1,t2,t3) returns F\n");
end

EXPORT CONTROL :
Cet email ne contient pas de données techniques
This email does not contain technical data

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20150827/2a1755bd/attachment.htm>


More information about the users mailing list