4 ms·
It's not problem of 'eq': % expr {1 == "1"} 1
by ytch 9y ago
It's not problem of 'eq':
% expr {1 == "1"}
1
- deleted 9y ago[deleted]
- blacksqr 9y agoPlaying around a bit with tio.run-- Javascript: console.log("1"==1) True Perl: print "1"==1; 1 What's your preferred language?
- blacksqr 9y agoPHP: <?php echo "1"==1; ?> 1
- ytch 9y agoMost of my work use Python right now Python 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> "1"==1 False I don't even notice so many script language has "1"==1, that's interesting. I also find that in Javascript: >>typeof(1) "number" >>typeof("1") "string" PHP: >>> gettype("1") => "string" >>> gettype(1) => "integer" Can distinguish this two type, but AFAIK, I can't do this in Tcl?
- mypalmike 9y agoA major reason Java programs are generally quite robust IMO... System.out.println(1 == "1"); error: incomparable types: int and String