Why combine strings?

Complete newb question. Whats the point of combining strings? Doesnt it make more sense to just create one string to begin with? If so, whats the point of making, then combining two strings?

Lets say you have someones first and last name, at some points in the application you might only want to display the surname, while at other points, you want to display full name. Then you will need to concatenate the string, given you don’t want to store duplicate data.

string concatenation is really useful, although in the beginning it might be difficult to see why. Quite a common phenomenon when people start programming, that a concept is explained, and might take time to see why and when this is useful

1 Like

This topic was automatically closed 18 hours after the last reply. New replies are no longer allowed.