Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikibooksThe Free Textbook Project
Search

Ada Programming/Keywords/or

From Wikibooks, open books for an open world
<Ada Programming |Keywords
Computing »Computer Science »Computer Programming »Ada Programming

Ada. Time-tested, safe and secure.
Ada. Time-tested, safe and secure.

Logical operator

[edit |edit source]

Boolean operator

[edit |edit source]
X : Boolean := A < 10or A > 20;

Boolean shortcut operator

[edit |edit source]

In the below example the functionG is only called whenF(X) returns the valueFalse.

if F(X)orelse G(Y)then    Walk_The_Dog;endif;

This shortcut operator is sometimes used to speed up the evaluation of boolean expressions, but the Ada Style Guide recommends to compare the performance of both forms before switching one to the other. In general, it is good idea to useorelse in sake of performance only when the second expression involves a function call.

Theorelse form is also used when the second expression is known to raise an exception unless the first expression isFalse.

Unlike C/C++, Ada short-cut operators are not the standard way to evaluate boolean expressions. This is because Ada is designed to do by default what is generally safer, but lets the programmer request a different behaviour.

Boolean operator on arrays

[edit |edit source]

The or operator is applied to each pair of boolean elements from the left and right arrays. The result has the same bounds as the left operand.

type Day_Of_Monthisrange 1 .. 31;type Month_Arrayisarray (Day_Of_Month)of Boolean;X : Month_Array := Function_1;Y : Month_Array := Function_2;Z : Month_Array := Xor Y;

Bitwise operator

[edit |edit source]

The operatoror could be used withmodular types to perform bitwise operations.

Select statement

[edit |edit source]

alternative

[edit |edit source]

SeeAda Programming/Tasking#Selective waiting.

delay

[edit |edit source]

SeeAda Programming/Tasking#Timeout.

See also

[edit |edit source]

Wikibook

[edit |edit source]

Ada 95 Reference Manual

[edit |edit source]

Ada 2005 Reference Manual

[edit |edit source]

Ada Quality and Style Guide

[edit |edit source]


Ada Keywords
abortelsenewreturn
abselsifnotreverse
abstract (Ada 95)endnull
acceptentryselect
accessexceptionofseparate
aliased (Ada 95)exitorsome (Ada 2012)
allotherssubtype
andforoutsynchronized (Ada 2005)
arrayfunctionoverriding (Ada 2005)
attagged (Ada 95)
genericpackagetask
begingotoparallel (Ada 2022)terminate
bodypragmathen
ifprivatetype
caseinprocedure
constantinterface (Ada 2005)protected (Ada 95)until (Ada 95)
isuse
declareraise
delaylimitedrangewhen
deltalooprecordwhile
digitsremwith
domodrenames
requeue (Ada 95)xor


Ada Operators
andand then>+abs&
oror else>=-mod
xor=<*remin
not/=<=**/not in
Retrieved from "https://en.wikibooks.org/w/index.php?title=Ada_Programming/Keywords/or&oldid=3250148"
Category:
Hidden category:

[8]ページ先頭

©2009-2025 Movatter.jp