-- Shows literals and named and based numbers
-- Literals are values that are represented directly in a program
with ada.text_io; use ada.text_io;
procedure consts_lits is
-- TYPED CONSTANT
light: constant Integer := 299_792_458; -- meters per second
-- NAMED NUMBERS
pi: constant := 3.141_593_589_793_238_462_643_383_279_502;
one_third: constant := 1 / 3; -- Really is 1 / 3
one: constant := one_third * 3; -- Really is one
-- Some randomly chosen BASED NUMBERS
bin: Natural := 2#1010_0001#;
oct: Natural := 8#1234_5670#;
hex: Natural := 16#1A3C_5F70#;
-- NUMERIC LITERALS are above
-- OTHER literals
c: Character := 'a';
s: String := "ABC";
t: String := "A""C"; -- String A"C
b: Boolean := false;
-- ENUMERATED TYPES provide NEW LITERALS
type Days is (Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday);
d: Days := Friday;
begin
put_line("c is " & c);
put_line("s and t are " & s & t);
put_line("b is " & b'img);
put_line("Today is " & d'img);
end consts_lits;