
Basic Data Operation

This is a basic data operation. It represents a fundamental action on a basic data type.
You may see other such operations in the Basic Data Operations category, or:


Integer Operations
Arithmetic |
Comparison
Boolean Operations
Bitwise |
Logical
String Operations
Concatenation |
Interpolation |
Comparison |
Matching
Memory Operations
Pointers & references |
Addresses


Task

Write a function that takes two logical (boolean) values, and outputs the result of "and" and "or" on both arguments as well as "not" on the first arguments.

If the programming language doesn't provide a separate type for logical values, use the type most commonly used for that purpose.

If the language supports additional logical operations on booleans such as XOR, list them as well.




/*REXX program  demonstrates some  binary  (also known as  bit  or logical)  operations.*/
                        x= 1    ;    @x= ' x '   /*set the initial values of  X  and Y, */
                        y= 0    ;    @y= ' y '   /*  and a couple of literals for HDRs. */
                                                 /* [↓]  echo  the   X  and  Y   values.*/
call $ 'name', "value"                           /*display the  header  (title) line.   */
call $ 'x'   ,    x                              /*display "x"  and then the value of X.*/
call $ 'y'   ,    y                              /*   "    "y"   "    "   "    "    " Y */
                                                 /* [↓]  negate the X; then the Y value.*/
call $ 'name', "negated"                         /*some REXXes support the  ¬  character*/
call $ 'x'   ,   \x                              /*display "x"  and then the value of ¬X*/
call $ 'y'   ,   \y                              /*   "    "y"   "    "   "    "    " ¬Y*/
say
say
call $ @x, @y, 'AND';    do x=0  to 1;   do y=0  to 1;   call $ x, y, x  & y;    end;  end
call $ @x, @y, 'OR' ;    do x=0  to 1;   do y=0  to 1;   call $ x, y, x  | y;    end;  end
call $ @x, @y, 'XOR';    do x=0  to 1;   do y=0  to 1;   call $ x, y, x && y;    end;  end
exit 0                                           /*stick a fork in it,  we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
$: parse arg @.1, @.2, @.3, @.4;         hdr= length(@.1) \== 1;        if hdr  then say
             do j=0  to hdr;             _=
                   do k=1  for arg();    _= _  center(@.k, 7)
                   end   /*k*/
             say _
             @.= copies('═', 7)                  /*define a new header separator line.  */
             end         /*j*/
   return