Skip to content
EntityQ1413450· pop 8· linked from 54 articles

precondition

Sign in to save

Also known as input condition, preconditions, input conditions

In computer programming, a precondition is a condition or predicate that must always be true just prior to the execution of some section of code or before an operation in a formal specification.

Wikidata facts

Subclass of
condition
Show 1 more fact
different from
postcondition
Sources (2)

via Wikidata · CC0

~4 min read

Encyclopedic overview

6 sections
Contents
  • Example
  • In object-oriented programming
  • Eiffel example
  • Preconditions and inheritance
  • See also
  • References

In computer programming, a precondition is a condition or predicate that must always be true just prior to the execution of some section of code or before an operation in a formal specification.

If a precondition is violated, the effect of the section of code becomes undefined and thus may or may not carry out its intended work. Preconditions that are missing, insufficient, or not formally proved (or have an incorrect attempted proof), or are not checked statically or dynamically, can give rise to Security problems, particularly in unsafe languages that are not strongly typed.

Excerpted from Wikipedia’s “precondition” article, available under the CC BY-SA 4.0 licence.

Available in 8 languages

via Wikidata sitelinks · CC0