Plus
From Free Pascal wiki
│
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
system.add
system.concat
returns concatenation of stringsstrings.strcat
returns concatenation ofpchar
strings
single characters |
|
character pairs |
|