Difference between revisions of "Plus"
From Free Pascal wiki
Jump to navigationJump to search (remove Template:Stub) |
m |
||
Line 2: | Line 2: | ||
<div style="float:right; margin: 0 10px 10px 0; padding:40px; font-size:500%; font-family: Georgia; background-color: #f9f9f9; border: 2px solid #777777;">+</div> | <div style="float:right; margin: 0 10px 10px 0; padding:40px; font-size:500%; font-family: Georgia; background-color: #f9f9f9; border: 2px solid #777777;">+</div> | ||
− | |||
The symbol <syntaxhighlight lang="pascal" enclose="none">+</syntaxhighlight> (pronounced “plus”) is used to: | The symbol <syntaxhighlight lang="pascal" enclose="none">+</syntaxhighlight> (pronounced “plus”) is used to: | ||
Line 11: | Line 10: | ||
* (FPC) concatenate two strings (or characters; except [[PChar|<syntaxhighlight lang="pascal" enclose="none">pchar</syntaxhighlight>]]). | * (FPC) concatenate two strings (or characters; except [[PChar|<syntaxhighlight lang="pascal" enclose="none">pchar</syntaxhighlight>]]). | ||
− | + | <syntaxhighlight lang="pascal" line> | |
− | <syntaxhighlight lang="pascal" line | ||
program plusDemo(input, output, stderr); | program plusDemo(input, output, stderr); | ||
Line 38: | Line 36: | ||
== see also == | == see also == | ||
− | |||
* {{Doc|package=RTL|unit=system|identifier=add|text=<syntaxhighlight lang="pascal" enclose="none">system.add</syntaxhighlight>}} | * {{Doc|package=RTL|unit=system|identifier=add|text=<syntaxhighlight lang="pascal" enclose="none">system.add</syntaxhighlight>}} | ||
* {{Doc|package=RTL|unit=system|identifier=concat|text=<syntaxhighlight lang="pascal" enclose="none">system.concat</syntaxhighlight>}} returns concatenation of strings | * {{Doc|package=RTL|unit=system|identifier=concat|text=<syntaxhighlight lang="pascal" enclose="none">system.concat</syntaxhighlight>}} returns concatenation of strings | ||
Line 44: | Line 41: | ||
{{Symbols}} | {{Symbols}} | ||
+ | |||
[[Category:Pascal]] | [[Category:Pascal]] | ||
[[Category:Symbols]] | [[Category:Symbols]] | ||
[[Category:Code]] | [[Category:Code]] |
Revision as of 23:52, 10 April 2018
│
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
).
1program plusDemo(input, output, stderr);
2
3var
4 x: longint;
5 g: set of (foo, bar);
6 m: string;
7begin
8 // unary operator: positive sign
9 x := +7; // x becomes positive 7
10 x := +$100; // x becomes 256
11 // (dollar sign denotes hexadecimal base)
12
13 // addition
14 x := 7 + 7; // x becomes 14
15 x := 7 + 7 + 7 + 7 + 7 + 7; // x becomes 42
16
17 // union of sets
18 g := [foo] + [bar]; // g becomes [foo, bar]
19
20 // concatenation of strings and/or characters (FPC/Delphi extension)
21 m := 'Hello ' + 'world!'; // m becomes 'Hello world!'
22end.
see also
system.add
system.concat
returns concatenation of stringsstrings.strcat
returns concatenation ofpchar
strings
single characters |
|
character pairs |
|