Hacker News new | past | comments | ask | show | jobs | submit login

I just wanted to introduce "1/21" as an answer



Ahh I see the confusion now. I suggested it in the comment you were replying to:

> “1/2” concatenates with “1”

…and thought you’d spotted that and was saying others had disagreed with the concatenation way of handling + operators with strings.


"“1/2” concatenates with “1”" != "1/21"


That’s literally what concatenation is.


> Concatenate is a process of combining two or more strings into a single larger string. It's an important function in programming and computing because it allows you to store and combine multiple pieces of data when needed.

https://www.lenovo.com/us/en/glossary/concatenate/#:~:text=C...

That doesn't make those two strings equal, however.


Im not using the term in any weird way here. JavaScript even has a function specifically called “concat” and the ‘cat’ utility in UNIX is short for “concatenation”

You can try string concatenation in 3 differently languages using the links below:

https://www.w3schools.com/python/python_strings_concatenate....

https://go.dev/play/p/Q5VPF2ANk7Y

https://www.w3schools.com/jsref/jsref_concat_string.asp

Edit: who said anything about making both side of the operator equal? That’s not how operators work.




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

Search: