Ada Programming/Operators
From Wikibooks, the open-content textbooks collection
Contents |
[edit] Standard operators
Ada allows operator overloading for all standard operators and so the following summaries can only describe the suggested standard operations for each operator. It is quite possible to misuse any standard operator to perform something unusual.
Each operator is either a keyword or a delimiter -- hence all operator pages are redirects to the appropiate keyword or delimiter.
The list is sorted from lowest precedence to highest precedence.
[edit] Logical operators
[edit] Relational operators
- /=
- Not Equal
, (also special character /=) - =
- Equal x = y, (also special character =)
- <
- Less than x < y, (also special character <)
- <=
- Less than or equal to (
), (also special character <=) - >
- Greater than (x > y), (also special character >)
- >=
- Greater than or equal to (
), (also special character >=)
[edit] Binary adding operators
- +
- Add x + y, (also special character +)
- -
- Subtract x - y, (also special character -)
- &
- Concatenate , x & y, (also special character &)
[edit] Unary adding operators
[edit] Multiplying operator
- *
- Multiply,
, (also special character *) - /
- Divide x / y, (also special character /)
- mod
- modulus (also keyword mod)
- rem
- remainder (also keyword rem)
[edit] Highest precedence operator
- **
- Power xy, (also special character **)
- not
- logical not
, (also keyword not) - abs
- absolute value | x | (also keyword abs)
[edit] Shortcut operators
The shortcut operators cannot be overloaded.
- and then
- e.g.
if Y /= 0 and then X/Y > Limit then ... - or else
- e.g.
if Ptr = null or else Ptr.I = 0 then ...
[edit] Membership tests
The Membership Tests also cannot be overloaded.
- in
- element of,
, e.g. if I in Positive then, (also keyword in) - not in
- not element of,
, e.g. if I not in Positive then, (also keywords not in)
[edit] See also
[edit] Wikibook
[edit] Ada 95 Reference Manual
[edit] Ada 2005 Reference Manual
[edit] Ada Quality and Style Guide
| Ada Operators | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
, (also keyword
, (also keyword
, (also keyword 
