negate_condition: Negate the condition of if/while statements

View source: R/mutator-condition.R

negate_conditionR Documentation

Negate the condition of if/while statements

Description

Wraps the condition expression of each matching statement in !(...). For example, ⁠if (x > 0)⁠ becomes ⁠if (!(x > 0))⁠.

Usage

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

Arguments

statements

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

Value

A Mutator object.

Examples

negate_condition()
negate_condition(statements = "if")

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