HyperMath

Concatenation - Strings

Concatenation - Strings

Previous topic Next topic No expanding text in this topic  

Concatenation - Strings

Previous topic Next topic JavaScript is required for expanding text JavaScript is required for the print function  

Strings can be joined together using the concatenation operator "+".  For example:

> print("hello" + " HyperMath user")

hello HyperMath user

 

> who = "HyperMath user"

> print("hello " + who)

hello HyperMath user

Numbers can be concatenated to strings.  In this case, they are coerced into strings and then concatenated.  See Coercion for more information.

> print("Total bottles: " + 10)

Total bottles: 10

 

> print(type("Total bottles: " + 10) )

string // the number 10 is converted to string and then concatenated