2.4. Operators and Arithmetics - JulTob/Ada GitHub Wiki
Ada Operators
--- Logical ---
and -- Boolean and -- &&
or -- Boolean or -- ||
xor -- Boolean xor
not -- Boolean not -- ~
-- Highest precedence
--- Relational ---
= -- Equals -- ==
/= -- Not equals -- !=
< -- Less than
> -- More than
<= -- Less or equal to
>= -- More or equal
--- Unary ---
+ -- Positive -- +1
- -- Negative -- -1
--- Binary ---
+ -- Addition -- 1+2
- -- Subtraction -- 1-2
& -- Concatenation -- 'a'& 'b' = "ab"
--- Multiplicatives ---
* -- Multiplication
/ -- Division
mod -- Modulus -- % -- 0..m
rem -- Remainder -- Can be negative
abs -- Absolute Value
-- Highest precedence
** -- Power
--- Logic extension ---
-- (Fake Operators) --
and then -- Short circuited and
or else -- Short circuited else
in -- Value in range
not in -- Short for not( ...in...)
Boolean operations: and
, or
, not
, xor
Comparisons: >
, >=
, <
, <=
, =
, /=
Unary operations: +
, -
, abs
Binary Operations: +
, -
, *
, /
, mod
, rem
, &
, **
Short circuiting operations are not considered true operators, and as such, can't be overloaded. Same for membership operators (in).
Assignment :=
is considered a statement, not an operator.
&
is a binary operator that, by default, concatenates two arrays of fixed length (or elements) into a new fixed array.
-- function "&" (Left : in Element; Right : in Element)
-- return array_Type;
type Vector is array (1 .. 5) of Integer;
V1, V2 : Vector;
...
V1 & V2
'a' & "BCDE"