Your code (after syntax correction) is:
if {[expr 2000.0 - [lindex $llend [expr $i+0] 0 ]] > 80} {
puts "Error: Results > 80"
}
That has the problem that it is using unbraced expressions, and that's almost always a mistake. In particular, when the lindex returns an empty string, it will produce an extremely misleading error.
If we rewrite in conventional form (bearing mind that the condition argument is an expression anyway):
if {2000.0 - [lindex $llend $i 0] > 80} {
puts "Error: Results > 80"
}
Then the code (coincidently now efficiently bytecode-able) will probably produce a more informative error telling you that you can't use an empty string as an argument to subtract.
If, in the unlikely case you have a list of expressions rather than numbers, you need to evaluate an inner expression, it is still best to limit the scope of that and only ever provide a single argument to expr, like this:
if {2000.0 - [expr [lindex $llend $i 0]] > 80} {
puts "Error: Results > 80"
}
There's literally never a good reason to apply [expr ...+0] to an index argument to lindex.
llendandiare, it's impossible to say why the math is wrong.ifis already evaluated (internally) by expo, so you can writeif {2000.0 - [lindex $llend $i 0] > 80} {...}exprinside aniftest, or to not brace the expression forexprto evaluate. Are you putting complex expressions in either thellendorivariables?