tcl::mathop logic
The command of the operator not of logic.
tcl::mathop::! BOOLEAN
Description
! gives 1 when BOOLEAN is false and 0 when it is true. A number is false when it is zero. A text is a boolean of Tcl, such as yes, no, true, false, on, and off.
The operators && and || have no command. The arguments of a command are substituted before the call, so a command cannot skip its second argument as && does.
Arguments
| Argument | Type | Default | Description |
|---|---|---|---|
| BOOLEAN | boolean or number | required | A number or a boolean word. |
Returns
1 or 0.
Examples
% tcl::mathop::! 0
1
% tcl::mathop::! 0.0
1
% tcl::mathop::! yes
0
% tcl::mathop::! 1.5
0
Errors
% tcl::mathop::!
wrong # args: should be "tcl::mathop::! boolean"
-errorcode TCL WRONGARGS
# Tcl 9.1 only
% tcl::mathop::! x
cannot use non-numeric string "x" as operand of "!"
-errorcode ARITH DOMAIN {non-numeric string}
# Tcl 8.6 only
% tcl::mathop::! x
can't use non-numeric string as operand of "!"
-errorcode ARITH DOMAIN {non-numeric string}
Facts
- Capability
- None.
- Tcl release
- Tcl 9.1 and 8.6.
- Since
- ztcl 1.0.0-beta.1