This is not necessarily the current version of this TIP.
| TIP: | 182 |
| Title: | Add [expr bool] Math Function |
| Version: | $Revision: 1.2 $ |
| Author: | Joe Mistachkin <joe at mistachkin dot com> |
| State: | Draft |
| Type: | Project |
| Tcl-Version: | 8.5 |
| Vote: | Pending |
| Created: | Tuesday, 23 March 2004 |
This TIP proposes a new function bool() for use with the [expr] command.
This math function would be very useful in a number of different situations, such as:
if {bool(true)} then { puts "True" }
if (bool(0x1)} then { puts "True" }
A new math function named bool would be added to the list of functions supported by the [expr] command.
expr {bool( value )}]
This would return "1" for any value of value that is non-zero (plus all non-numeric strings accepted as true by Tcl_GetBoolean()) and "0" otherwise.
A reference implementation does not yet exist. Internally, the function should use something semantically equivalent to using Tcl_GetBoolean().
This document has been placed in the public domain.
This is not necessarily the current version of this TIP.