pf:rpldocs:logical_operators
- logical operators.txt
=CMD
=COMMAND and (bool bool) bool
=DESC
Pops two items from the stack and treats them as TRUE/FALSE (0/1 or Boolean) values. If they are both TRUE, 1 is pushed to the stack. Otherwise, 0 is pushed to the stack.
=ENDDESC
=EX
if (1 and (true))
trace("1 and true are both true")
endif
=ENDEX
=ENDCMD
=CMD
=COMMAND or (bool bool) bool
=DESC
Pops two items from the stack, treats them as boolean values, 'ors' them, and pushes 0 or 1 back to the stack.
If either items are TRUE, or both are TRUE, it returns TRUE to the stack. If both items are FALSE, FALSE is returned to the stack.
=ENDDESC
=EX
if (1 or (false))
trace("1 or false is true")
endif
=ENDEX
=ENDCMD
=CMD
=COMMAND xor (bool bool) bool
=DESC
Pops two items from the stack, treats them as boolean values, 'xors' them, and pushes 0 or 1 back to the stack.
If both items are TRUE, 0 is pushed to the stack. If both items are FALSE, 0 is pushed to the stack. If one item is TRUE and the other is FALSE, 1 is pushed to the stack.
=ENDDESC
=EX
if (1 xor (false))
trace("1 xor false is true")
endif
=ENDEX
=ENDCMD
=CMD
=COMMAND not (bool) bool
=DESC
Pops one item from the stack, treats it as a boolean value, 'nots' it, and pushes 0 or 1 back to the stack.
If the item is TRUE, 0 is pushed to the stack. If the item is FALSE, 1 is pushed to the stack.
=ENDDESC
=EX
if (not(false))
trace("not false is true")
endif
=ENDEX
=ENDCMD
pf/rpldocs/logical_operators.txt · Last modified: 2016/10/16 17:43 by Karsten75