fn: forget
[contents]

Contents

Syntax

The syntax for forget calls is:

f++:  
forget(params)

n++:  
@forget(params)

Description

The forget function is for forgetting variables, it takes a non-zero number of parameters that should be variables that have previously been defined and forgets them.

Note: Nift will skip to the first non-whitespace (ie. to the first character that is not a space, tab or newline) after a forget call and inject it to the output file where the call started. If you want to prevent Nift from doing this put a '!' after the call, eg.:

@forget(x)!

Options

The following options are available for forget calls:

option description
exprtk remove bool, int, double, char, string and std::vector<double> variables from ExprTk symbol table
option description

Note: If you use the option to remove a variable/symbol from the ExprTk symbol table then try to evaluate an expression using the variable/symbol without it being redefined then you will get a segmentation fault. This is why forget does not remove variables/symbols from the ExprTk symbol table by default.

f++ example

Example of forget being used with f++:

int i = 0
string str = "hello"
forget(i, str)

n++ example

Example of forget being used with n++:

@int i = 0
@string str = "hello"
@forget(i, str)