Adding Strings and Numbers

Adding two numbers, will return the sum, but adding a number and a string will return a string:

   x = 5 + 5;      (The value of x is 10)

   y = "5" + 5;      (The value of y is 55)

   z = "Hello" + 5;      (The value of z is Hello5)

The rule is: If you add a number and a string, the result will ALWAYS be a string!

Back Table of Contents Next