Boolean Assignment

A Boolean assignment assigns the value of the Boolean expression on the right side of the assignment operator (:=) to the Boolean target on the left side.

<Boolean assignment>

──┬─<Boolean variable>─┬─────────────────────┬─────────────────────────►
  │                    └─<partial word part>─┤
  ├─<Boolean type transfer variable>─────────┤
  └─<Boolean attribute>──────────────────────┘
►─┬─ := ──<Boolean expression>──┬──────────────────────────────────────┤
  └─<Boolean update assignment>─┘

Boolean Variables

<Boolean variable>

A <variable> of type Boolean.

<Boolean type transfer variable>

── BOOLEAN ── ( ──<variable>─┬─────────────────────┬─ ) ─┬─────────────┤
                             ├─<partial word part>─┘     │
                             └─ ) ──<partial word part>──┘

If the <Boolean variable> <partial word part> syntax or the <Boolean attribute> syntax appears in a statement with multiple assignments, then it must appear as the leftmost target in the statement. The following examples illustrate this rule:

Allowed

Not Allowed

X.[7:8] := Y := FALSE

Y := X.[7:8] := FALSE

F1.OPEN := OPENED := FALSE

OPENED := F1.OPEN := FALSE

A <Boolean variable> <partial word part> assignment leaves the remainder of the Boolean variable unchanged, despite any possible side effects, such as embedded assignments, in the Boolean expression.

Boolean Attributes

<Boolean attribute>

──┬─<Boolean file attribute>─────────┬─────────────────────────────────┤
  ├─<Boolean direct array attribute>─┤
  ├─<Boolean task attribute>─────────┤
  └─<Boolean library attribute>──────┘

<Boolean file attribute>

──<file designator>─┬─────────────────────────────────────┬─ . ────────►
                    └─<attribute parameter specification>─┘
►─<Boolean-valued file attribute name>─────────────────────────────────►
►─┬─────────────────────────────────┬──────────────────────────────────┤
  └─ ( ──<arithmetic variable>── ) ─┘

The attribute error number returned from the operating system can be captured in the <arithmetic variable>.

<Boolean direct array attribute>

──<direct array row>── . ──────────────────────────────────────────────►
►─<Boolean-valued direct array attribute name>─────────────────────────┤

<Boolean-valued direct array attribute name>

ALGOL supports all direct array attributes and direct array attribute values described in the File Attributes Programming Reference Manual.

<Boolean task attribute>

──<task designator>── . ──<Boolean-valued task attribute name>─────────┤

<Boolean-valued task attribute name>

──┬─ LOCKED ─┬─────────────────────────────────────────────────────────┤
  └─ TADS ───┘

<Boolean library attribute>

──<library attribute designator>── . ──────────────────────────────────►
►─<Boolean-valued library attribute name>──────────────────────────────┤

Boolean Update Assignment

<Boolean update assignment>

──<update symbols>─┬─────────────────────────────────────────────────┬─┤
                   └─<Boolean operator>──<simple Boolean expression>─┘

The Boolean update assignment is a shorthand form of assignment that can be used when the Boolean target on the left side of the assignment operator (:=) also appears in the Boolean expression on the right side of the operator. The Boolean update assignment form can be specified only following a Boolean target that does not contain a partial word part. The asterisk (*) represents a duplication of the item to the left of the assignment operator. For example, the following two assignments produce the same results:

B := * AND BOOL
B := B AND BOOL

The target item is not reevaluated at the appearance of the asterisk.

If the item to the left of the assignment operator is a subscripted variable, it cannot reference a value array.

Examples of Boolean Assignments

BOOL := TRUE

BOOLARRAY[N].[30:1] := Q < VAL

HIGHER := PTR > PTS FOR 6

TAUTOLOGY := * OR TRUE

STRUCTURE_BLOCK_VARIABLE.B := STRUCTURE_BLOCK_ARRAY[2].B;