Ada Programming/Attributes/'Modulus

From Wikibooks, open books for an open world
Jump to navigation Jump to search

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

Description[edit | edit source]

X'Modulus is an Ada attribute where X is any modular type. This returns the modulus of X.

Example[edit | edit source]

type Unsigned_Byte is mod 2**8;
type Unsigned_Word is mod 2**16;
 
pragma Assert (Unsigned_Byte'Modulus = 256);  -- Ok
pragma Assert (Unsigned_Word'Modulus = 65536);  -- Ok

See also[edit | edit source]

Wikibook[edit | edit source]

Ada Reference Manual[edit | edit source]