/test

Usage:

/TEST expression


/test evaluates the expression and returns its value, also setting the special variable %?. The return value may be any type (before version 4.0, only integer values were allowed). A new variable scope is NOT created.

/Test can be useful for evaluating an expression for its side effects, ignoring the return value. For example, the command "/test kbdel(kbpoint() - 1)" will perform a backspace, and "/test regmatch('foo(.*)', 'foobar')" will assign "bar" to %P1.

Before version 3.5, /test was frequently used as the condition of an /IF or /WHILE statement. This is no longer needed, since /IF and /WHILE can now take an expression as a condition.

Before version 4.0, /test was sometimes used to set the return value of a macro, since a macro's return value is that of the last command executed. The preferred way to do this now is with /return or /result.

See: /return, /if, /while, expressions, evaluation, variables


Back to index
Back to tf home page
Copyright © 1995 - 1999 Ken Keys