Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2007-09-24
23:42 • Ticket [1801314fff] Numeric Comparisons 101 - if: Error in example code stat... artifact: cf3ba5453f user: nobody
16:41 • New ticket [1801314fff]. artifact: 741894a02c user: nobody

Numeric Comparisons 101 - if: Error in example code

Open1801314fffffffffffffffffffffffffffffffffCreated 19 years agoUpdated 19 years ago
Descriptionplain2007-09-24 16:41:34
#
# A dangerous example: due to the extra round of substitution,
# the script stops
#
set y {[exit]}
if "$$y != 1" {
    puts "$$y is != 1"
} else {
    puts "$$y is 1"
}
[email protected]plain2007-09-24 23:42:52
Logged In: NO 

I believe the dangerous line should read:
if "$y != 1" {
To cause the evaluation of exit after substitution.
Log in (anonymous is fine) to add a comment.