+ 2
String operation
Cans someone help me with why a string addedto a number gives an error? Eg: ‘5’ + 6
2 odpowiedzi
+ 3
In most programming languages, you can only do operarions on two pieces of data that are the same type. One exception is when it is possible to implicitly type-cast one of the operands, for example when you add an integer and a float:
5 + 6.0 = 11.0
Strings are not numeric types, so most programming languages will freak out if you try to add a number to a string :)
+ 3
thank you so much:)