RosettaCodeData/Task/Logical-operations/Octave/logical-operations.octave

14 lines
337 B
Plaintext

function test(a, b)
s1 = num2str(a);
s2 = num2str(b);
disp(strcat(s1, " and ", s2, " = ", num2str(a&&b)));
disp(strcat(s1, " or ", s2, " = ", num2str(a||b)));
disp(strcat("not ", s1, " = ", num2str(!a)));
endfunction
% constant true is 1, false is 0
test(true, true);
test(false, false);
test(true, false);
test(false, true);