Learn R Programming

exams.forge (version 1.0.11)

catif: Conditional Cat Output

Description

Prints text using cat only when a specified logical condition is TRUE.

Usage

catif(cond, ...)

condition_cat(cond, ...)

Value

Invisibly returns the value of cond.

Arguments

cond

Logical value. If TRUE, the text provided in ... is printed using cat; if FALSE, nothing is printed.

...

Additional arguments passed to cat.

Examples

Run this code
catif(TRUE, "PDF")          # This text is printed
catif(FALSE, "Moodle")      # Nothing is printed
condition_cat(TRUE, "Hello") # Alias works the same way

Run the code above in your browser using DataLab