การเรนเดอร์th-TH

∧

Translation status: ภาษาไทย reader-locale proof. Term names and code fences follow the th-TH pack; supporting prose may still be English.

Bitwise and, or, xor, not, and shifts on จํานวน operands.

Syntax: <expression> ∧ <expression> | <expression> ⊻ <expression> | ¬ <expression> | <expression> ⇐ <expression> | <expression> ⇒ <expression>

Category#

bitwise

Examples#

radix/corpus/operatores/bitwise.fab (canonical · operator-group)#

Bitwise and, or, xor, not, and shifts on จํานวน operands.

# =============================================================================
# ∧ — Bitwise and, or, xor, not, and shifts on จํานวน operands.
# =============================================================================
#
# What this teaches:
#   • Bitwise operators — `∧` (and), `∨` (or), `⊻` (xor), `¬` (not), `⇐` (shift left), `⇒` (shift right).
#   • Integer bit patterns — Visual demonstration of bitwise operations with binary literals.
#
# Common mistakes:
#   • Confusing ∧ (bitwise and) with et (logical and) — they operate at different levels.
#
# See also: ∨, ⊻, ¬, ⇐, ⇒
# =============================================================================

# operatores/bitwise — ∧ ⊻ ¬ ⇐ ⇒
#
# GRAMMAR:
#   bitwiseExpr :← expr ('∧' | '⊻' | '⇐' | '⇒') expr | '¬' expr
#
# EXPECTED OUTPUT:
#   8, 6, 16, 4
#
# BACKEND:
#   Integer bit patterns; cross-ref binarius/binarius.fab for combined tour.
#   Unary ¬ documented in syntax; Rust emits `~` (whitelist if reintroduced in body).

main {
    const _ vexilla ← 0b1010
    const _ persona ← 0b1100

    const _ coniuncta ← vexilla ∧ persona
    # 8 (0b1000)
    print coniuncta

    const _ diversa ← vexilla ⊻ persona
    # 6 (0b0110)
    print diversa

    const _ sinistra ← 1 ⇐ 4
    # 16
    print sinistra

    const _ dextra ← 16 ⇒ 2
    # 4
    print dextra
}

Expected output:

8
6
16
4