Guarded command

  • Authors:
  • Jerrold L. Wagener

  • Affiliations:
  • -

  • Venue:
  • Encyclopedia of Computer Science
  • Year:
  • 2003

Quantified Score

Hi-index 0.00

Visualization

Abstract

The term guarded command, as defined by Dijkstra (1975), is synonymous with a conditionally executed statement. More precisely, a guarded command is the combination of a condition (boolean expression) B and the (possibly compound) statement S whose execution is controlled by B. In a sense, B "guards" the execution of S. In Dijkstra's notation, a guarded command is represented as B → S. In more common notation, the meaning of a guarded command is very much like that of the simple selection structure (if statement): if B then S. Unlike the if statement, however, a guarded command, by itself, is not a complete statement in a programming language. Rather, it is one component of a more extensive control structure containing one or more guarded commands. The most interesting applications of guarded commands are those involving a set of n of them, for n 1.