remove_condition_negation: Remove negation from the condition of if/while statements

View source: R/mutator-condition.R

remove_condition_negationR Documentation

Remove negation from the condition of if/while statements

Description

The inverse of negate_condition(). Strips the leading ! from any already-negated condition, so ⁠if (!done)⁠ becomes ⁠if (done)⁠ and ⁠while (!ready)⁠ becomes ⁠while (ready)⁠.

Usage

remove_condition_negation(statements = c("if", "while"))

Arguments

statements

Character vector of statement types to target. Must be a subset of c("if", "while"). Defaults to both.

Details

Unlike remove_negation(), this mutator is scoped exclusively to conditions, leaving negations in other positions (assignments, return values, etc.) untouched.

Value

A Mutator object.

Examples

remove_condition_negation()
remove_condition_negation(statements = "while")

muttest documentation built on May 14, 2026, 5:10 p.m.