The & Command


Command Summary

Joins two strings together.

Command Syntax


Menu Location

  • Press 2nd MATH to enter the MATH popup menu.
  • Press D to enter the String submenu.
  • Press 4 to select &.

Calculator Compatibility

This command works on all calculators.

Token Size

2 bytes

The & operator joins two strings together, one after the other, returning one large string.

:"The value of n is "&string(n)
           "The value of n is 5"

Appending strings is very useful when you want to display text. If you want to display more than one string on the same line, for instance with the Text command, you'll need to use & to combine the strings.

By default, & doesn't put in any separation between the strings, which can look weird: you can see this in the above example, where joining "Hello" and "World" made "HelloWorld". With multiple uses of &, you can put in any separator you like:

:"Hello"&" "&"World"
           "Hello World"

If you want to use & to build up a string from scratch, start with "" — the empty string.

Related Commands

See Also

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License