Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Playing around a bit with tio.run--

Javascript:

  console.log("1"==1)
  True
Perl:

  print "1"==1;
  1
What's your preferred language?


Most 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?


A major reason Java programs are generally quite robust IMO...

    System.out.println(1 == "1");

    error: incomparable types: int and String


PHP:

  <?php
  echo "1"==1;
  ?>
  1




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: