I don't understand why my 8.6 tcl version does understand a for loop like this: "for{set i 0}{$i<10}{incr i}{

76 views Asked by At

I am using the tclsh interpreter and the Synopsis Primetime shell. Both are not supporting that kind of loop. is there something that I am missing here?

Thanks a lot

I am trying to perform a very standard for loop

1

There are 1 answers

2
TrojanName On

I think you just a syntax error. This works for me:

for {set x 0} {$x<10} {incr x} {
    puts "x is $x"
}

Outputs:

x is 0
x is 1
x is 2
x is 3
x is 4
x is 5
x is 6
x is 7
x is 8
x is 9