What are strings?

360 views

There is a recent tweet in which a lady said 1+2=12.

Obviously that is wrong but everyone keeps saying “it’s wrong unless we are talking about strings”

What are strings?

Edit: thank you all for explaining:) have a cookie 🍪 and a wonderful day

In: 6

10 Answers

Anonymous 0 Comments

They’re speaking of strings in the computer science sense.

A string is any set of characters. Concatenating two strings — smushing together the two sets of characters — is frequently done in computer programs by using the “+” sign.

So if you have one string that is the character “A” and another that is the character “B” then when you concatenate them (smush them together) you get a single string of “AB.”

A + B = AB

Likewise if you had a string that was “E” and a string that was “LI5” when you concatenate them you get a single string of “ELI5.”

E + LI5 = ELI5

Likewise, if you have a string that consists of the character “1” and a string that consists of the character “2” then when you concatenate them you get “12.”

1 + 2 = 12

Basically it’s treating the equation as *characters* (“strings”) instead of *numbers*.

You are viewing 1 out of 10 answers, click here to view all answers.