Skip to content

[Bioc-devel] Reminder about & vs && and | vs ||

1 message · Seth Falcon

#
Hello package maintainers,

Looking through the BioC sources I see many cases where the vectorized
logical operators | and & are being improperly used inside if().

The general rule is that inside an if() you want to use && and ||
because these return a logical value of length one.

When you want a vectorized logical operation, use | and &.  A warning
will be raised if you use & or | inside an if and the returned vector
has length greater than one.  So misuse will be noisy.

Please consider reviewing your package code and applying appropriate
fixes.

+ seth