dada
dada

Reputation: 1493

Many OR statements in tclsh

I am trying to execute in tclsh the following code :

set t 2
if { $t > 0 || $t < 30 || $t < 20 } { puts yes }

In a tclsh shell, I get the following error :

syntax error in expression " $t > 0 || $t < 30 || $t < 20 ": character not legal in expressions

What is the character that is not legal here ? I suspected '<' to be the problem but then I ran this command :

if { $t > 0 } { puts yes }

and I got 'yes' printed as expected.

Upvotes: 0

Views: 54

Answers (2)

Donal Fellows
Donal Fellows

Reputation: 137627

All visible characters appear legal. It's probably some sort of invisible space or something like that; Tcl 8.4 basically only really handled ASCII correctly in expressions (outside of quoted constants).

Upvotes: 0

don_q
don_q

Reputation: 415

Your code is valid, I would check the settings of your editor.

Upvotes: 0

Related Questions