RosettaCodeData/Task/Logical-operations/Octave/logical-operations.octave
Ingy döt Net d066446780 langs a-z
2013-04-10 22:43:41 -07:00

13 lines
337 B
Text

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);