and

and (leftOperand rightOperand -- combinedValue)

Inputs

Outputs

and accepts same-schema Cond, Nat, and Int values. Both inputs are dereferenced and must be non-NIL. The result keeps that schema.

This is not short-circuit control flow. By the time and runs, both operands are already on the data stack.

Behavior

Example

{} () {} [
  "-- no short-circuit cond --" printCompilerMessage
  "-- left operand --" printCompilerMessage FALSE
  "-- right operand --" printCompilerMessage TRUE
  and printStack _:;

  "-- cond --" printCompilerMessage
  TRUE TRUE and printStack _:;
  TRUE FALSE and printStack _:;
  unknownCond: FALSE dynamic;
  FALSE unknownCond and printStack _:;
  TRUE unknownCond and printStack _:;

  "-- nat32 masks --" printCompilerMessage
  0xF0n32 0xCCn32 and printStack _:;
  0xFFFFFFFFn32 0xCCn32 and printStack _:;
  0n32 0xCCn32 and printStack _:;
  unknownNat: 0n32 dynamic;
  0n32 unknownNat and printStack _:;
  0xFFFFFFFFn32 unknownNat and printStack _:;

  "-- int32 bitwise --" printCompilerMessage
  -1 6 and printStack _:;
  6 3 and printStack _:;
] "main" exportFunction

Expected Output During Compilation

-- no short-circuit cond --
-- left operand --
-- right operand --
FALSE
-- cond --
TRUE
FALSE
FALSE
Cond
-- nat32 masks --
192n32
204n32
0n32
0n32
Nat32
-- int32 bitwise --
6
2

See also