lecture20 Ada2

lecture20 Ada2 - Ada II "=": BOOLEAN operator for...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
Ada II
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
“=”:  BOOLEAN  operator for equality Is_It := (One + 1) = Two; Is_It := (1 + 1) = 2; Is_It := 2 = 2; Is_It := TRUE; The single equal sign is the BOOLEAN operator for equality, and if the two expressions being evaluated are of the same value, a value of TRUE will result. If they are not of the same value, the BOOLEAN result will be FALSE
Background image of page 2
Examples of BOOLEAN operators Question := Index = Count; -- Equality Question := Index /= Count; -- Inequality Question := Index < Count; -- Less than Question := Index <= Count; -- Less than or equal Question := Index > Count; -- Greater than Question := Index >= Count; -- Greater than or equal
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Examples of composite BOOLEAN  expressions Question := Index = 12 and Count = 12 and Truth and TRUE; Question := Index /= 12 or FALSE or Count > 3 or Truth Question := (Truth or Lies) and (Truth and not Lies); Question := Truth xor Lies;
Background image of page 4
Order of Precedence of Operators  ** not abs -- Highest precedence * / mod rem -- Multiplying operators + - -- Unary operators + - & -- Binary adding operators = /= < -- Relational operators <= > >= -- Relational operators in not in -- (same precedence) and or xor -- Logical operators and then or else -- (same precedence)
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Control Structures loop <...> end loop ; while <BOOLEAN expression>
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 23

lecture20 Ada2 - Ada II &quot;=&quot;: BOOLEAN operator for...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online