Elementary Types: Access Types Scalar Types
Elementary Types: Access Types Scalar Types
• Access Types
• Scalar Types
– Discrete Types
– Real Types
– Fixed Point Types
Discrete Types
• Integer Types
– Signed
type Marks is range 0..100;
finalScore : Marks;
NotYou
Youallowed
can
cannotin have
C arithmetic
add/subtract (increment or decrement)
operations on the value
of an enumeration
type BasicColors
enumeration type
types using the
is (Red, ‘Pred’ and
Orange, ‘Succ’
Yellow, Green,
keywords
Blue,
State’Pred
S1, (S1)
S2 : State;
Indigo, Violet);
typeState’Succ
S1
MyColors is(S2)
:= S1 + S2; -- Illegal
(Red, Orange, Yellow);
Boolean Types
• Predefined enumeration type
type Boolean is (False, True);