Skip to main content

Simplify Expression

Where possible, simplifies the Boolean expression.

#Purpose

  • Code readability can be greatly improved by reorganizing long Boolean expressions that are often found within if statements, return statement or variable assignments. This reorganization involves removing unnecessary parentheses, toggling negations, parameter reordering and so on without affecting the expression’s return value but making the entire expression easier to read.

#Availability

Available from the context menu or via shortcuts:

  • when the edit cursor, or caret is on an if statement whose condition can be simplified.
  • when the caret is on a return statement which has a Boolean expression that can be simplified.
  • when a Boolean expression that can be simplified is selected.

#Notes

  • This refactoring uses the Quine/McClasky simplification algorithm.

#Example

return a | b & a | c;
Return a Or b And a Or c

Result:

return a | c
Return a Or c

#Screenshot

SimplifyExpression

See Also