Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: cleaned up description a bit

The assert statement is a convenient mechanism for incorporating diagnostic tests in code. Expressions used with the standard assert statement must avoid side effects. Typically, the The behavior of the assert statement depends on the status of a runtime property. When enabled, the assert statement is designed to evaluate evaluates its expression argument and throw throws an AssertionError if the result of the expression is false. When disabled, assert is defined to be a no-op; any side effects resulting from evaluation of the expression in the assertion are lost when assertions are disabled. Consequently, programs expressions used with the standard assert statement must not use side-effecting expressions in assertionsproduce side effects.

Noncompliant Code Example

...