This article is part of the Getting Started series |
Variables can be suposed to a variety of operations.
addition | a:=b+c; |
subtraction | a:=b-c; |
multiplication | a:=b*c; |
division, with decimals | a:=b/c; |
division, without decimals | a:=b div c; |
modulo^{[1]} | a:=b mod c; |
square | a:=sqr(b); |
square root | a:=sqrt(b); |
n^{th} power, done manually, as no function for this has been included in the Borland dialect of Pascal | result:=1; for i:=1 to n do result:=result*a; {the n-th power of a, placed in the "result" variable} |
unification of sets | a:=b+c; |
difference of sets | a:=b-c; |
intersection of sets | a:=b*c; |
concatenation (unification of two strings) | a:=b+c; |
- ↑ Modulo is the rest (or change) of the division. For example 5 mod 2 = 1 and 4 mod 2 = 0
See alsoEdit
- For boolean operations, see Boolean variables.
- For complex string operations, see String operations.