TCL - Boolean

Card Puncher Data Processing

TCL - Boolean

About

Tcl defines :

  • true as any of 0, false, no, or off
  • false as any of 1, true, yes, y or on

In all case 1 or 0 is stored. These tokens are case insensitive, which means Yes, yes, and YES are the same.

If in the condition clause of an IF statement, TCL has :

  • a string: it try to convert it as an integer 0 and 1. Otherwise, you get an error
  • an integer: it check if the value is 0 otherwise it's true.

Example

True

/> set var 1
1
/> string is true $var
1
/> set var on
on
/> string is true $var
1
/> set var yes
yes
/> string is true $var
1
/> set var y
y
/> string is true $var
1

False

/> set var 0
0
/> string is false $var
1
/> set var off
off
/> string is false $var
1
/> set var no
no
/> string is false $var
1
/> set var n
n
/> string is false $var
1
/> set var false
false
/> string is false $var
1

In an IF statement

If in the condition clause of an IF statement, TCL has :

  • a string: it try to convert it as an integer 0 and 1. Otherwise, you get an error
  • an integer: it check if the value is 0 otherwise it's true.
/> set var -1
-1
/> if {$var} then {puts "true"} else {puts "false"}
true

Documentation / Reference





Discover More
Card Puncher Data Processing
OMBENV - environment variables

This command lists the values for all Warehouse Builder-specific environment variables. To set an environmental variable, use the Tcl set command. Use unset to unset an environmental variable. ...
Card Puncher Data Processing
Tool Command Language (TCL)

Tcl (from “Tool Command Language”) is a scripting language created by John Ousterhout. intended to be embedded into applications ( Oracle Warehouse Builder use it as scripting language : Mixed with...



Share this page:
Follow us:
Task Runner