pkgmaker (version 0.32.10)

sVariable: Global Static Variable

Description

sVariable defines a function that acts as a global static variable.

Usage

sVariable(default = NULL)

Value

A function that can be used to set/get the static variable.

Arguments

default

default value for the static variable.

Examples

Run this code

# define variable
x <- sVariable(1)
# get value (default)
x()
# set new value: return old value
old <- x(3)
old
# get new value
x()

Run the code above in your browser using DataLab