Plus

From Free Pascal wiki
Revision as of 23:31, 13 February 2018 by Kai Burghardt (talk | contribs) (remove Template:Stub)
Jump to navigationJump to search

English (en) suomi (fi) français (fr) русский (ru)

+


The symbol + (pronounced “plus”) is used to:

  • explicitly indicate the positive sign of a number,
  • add two numbers resulting to a number,
  • form a union of sets,
  • (FPC) concatenate two strings (or characters; except pchar).


 0program plusDemo(input, output, stderr);
 1
 2var
 3	x: longint;
 4	g: set of (foo, bar);
 5	m: string;
 6begin
 7	// unary operator: positive sign
 8	x := +7;                    // x becomes positive 7
 9	x := +$100;                 // x becomes 256
10	                            // (dollar sign denotes hexadecimal base)
11	
12	// addition
13	x := 7 + 7;                 // x becomes 14
14	x := 7 + 7 + 7 + 7 + 7 + 7; // x becomes 42
15	
16	// union of sets
17	g := [foo] + [bar];         // g becomes [foo, bar]
18	
19	// concatenation of strings and/or characters (FPC/Delphi extension)
20	m := 'Hello ' + 'world!';   // m becomes 'Hello world!'
21end.

see also


navigation bar: topic: Pascal symbols
single characters

+ (plus)  •  - (minus)  •  * (asterisk)  •  / (slash)
= (equal)  •  > (greater than)  •  < (less than)
. (period)  •  : (colon)  •  ; (semi colon)
^ (hat)  •  @ (at)
$ (dollar sign)  •  & (ampersand)  •  # (hash)
' (single quote)

character pairs

<> (not equal)  •  <= (less than or equal)  •  := (becomes)  •  >= (greater than or equal)

 •  >< (symmetric difference)  •  // (double slash)