4 ms·
> "abc" + "def" = "abcdef" vs "abc" . "def" = "abcdef" Would be better comparison if you would use whitespace in the other case as well. Which then makes it j
by lizmat 7y ago
> "abc" + "def" = "abcdef" vs "abc" . "def" = "abcdef"
Would be better comparison if you would use whitespace in the other case as well. Which then makes it just as readable.
Also. "0" + "42" would that be "042" or 42? It may be better readable, but the semantics are unclear.
- ofrzeta 7y agoThat's an argument for types. While it's more convenient to use a language without types it's more error prone. So I guess in the end strong typing wins. >>> 0 + 42 42 >>> "0" + "42" '042' >>> "0" + 42 Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: cannot concatenate 'str' and 'int' objects >>> int("0") + 42 42