Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Postcondition
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
In [[computer programming]], a '''postcondition''' is a condition or [[Predicate (mathematics)|predicate]] that must always be true just after the execution of some section of code or after an operation in a [[formal specification]]. Postconditions are sometimes tested using [[assertion (computing)|assertions]] within the code itself. Often, postconditions are simply included in the documentation of the affected section of code. For example: The result of a [[factorial]] is always an integer and greater than or equal to 1. So a program that calculates the factorial of an input number would have postconditions that the result after the calculation be an integer and that it be greater than or equal to 1. Another example: a program that calculates the [[square root]] of an input number might have the postconditions that the result be a number and that its [[square (algebra)|square]] be equal to the input.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)