Skip to main content

& (String concatenation)

Syntax

string1 & string 2

Description

The concatenation returns a string made of sticking both variables together. If some of the variables are not strings, the STR function is called automatically to convert the variable to a string. As of version 6.08 multiple concatenations per line are supported, and the strings can include string functions such as LEFT, RIGHT, HEX and STR.  Also if a constant or integer is used it will be automatically converted to a string, as if it had been enclosed in a STR().

Example

DIM A$(20)

DIM C$(20)

A$="The result is: "

B=1243

C$=A$ & B

PRINT C$

SLEEP

The output would look like:


The result is: 1243

 

Differences from other BASICs

  • same as Visual Basic functions
  • no equivalent in PBASIC

See also