Updated 2014-11-12 23:46:13 by dkf

Infix operator for string comparison inside expr. Returns true if its arguments are not string-equal.

Its opposite part is eq, which returns true if its arguments are string-equal.

Differs from != in such that its arguments cannot be treated as numerical values, so 1 != 1.0 returns false, but 1 ne 1.0 returns true.

% expr {"a" eq "b"}
% expr {"a" ne "b"}
% expr {"1" eq "1.0"}
% expr {"1" == "1.0"}

Also comparing text with ne is faster than !=. From Practical programming in Tcl and Tk, by Brent B. Welch, Ken Jones, Jeffrey Hobbs: "The eq and ne expr operators were introduced in 8.4 to allow more compact strict string comparison. These operations also work faster because the unnecessary conversions are eliminated."