Rev Language Reference


exists - Check whether a variable exists

Determines whether the RevBayes workspace contains a variable named 'name'

Usage

exists(String name)

Arguments

name : String (pass by value)
The name of the variable we wish to check for existence.

Return Type

Details

'exists' returns 'true' if the workspace contains a variable whose name matches the String 'name' and 'false' otherwise. One use of 'exists' is to add Move and Monitor objects conditional on the variable 'x' existing. The function 'ls' provides a summary for all variable names that 'exists' would evaluate as 'true'.

Example

## Correct usage: does "x" exist?
x <- 1.0
exists("x")

## Incorrect usage: does "1.0" exist?
exists(x)

See Also