Additional notes about Ada

 when you output an integer in Ada, it uses a default width

 

ada.integer_text_io.put (6);   

ada.integer_text_io.put (item => 6);   -- this statement is identical to the statement above9

 

 

alternatively, you can control the number of spaces it uses

 

ada.integer_text_io.put (item => 6, width => 5);

 

 

=>  is called an arrow  in Ada

 

<>  is called a box  in Ada

 

 

-- Ada’s predefined subtype positive

subtype positive is integer range 1.. integer’last;

 

The ada String type is declared as an unconstrained array of characters;

 

-- Ada’s predefined type string

Type string is  array (positive range  <>) of character;

 

--  a declaration of a string variable in Ada

-- when a string variable is declared it must be constrained

-- lowest index allowed is 1 because declaration specifies that the range is positive

MyName : string(1..5);

 

-- a declaration of a string constant  -- doesn’t require specification of range.  Range is taken from declaration

MyConstantString  : constant String := “however many characters in this string”;

 

-- a number of the examples show Ada’s exception handling capabilities

-- user can define own exceptions

-- exceptions in Ada are  raised   

-- exception handlers begin with the reserved word  exception

-- each individual handler begins with the reserved word  when 

-- after an exception is handled, control leaves the block in which the exception occurred which is why if the exception handler is inside a loop and

--  you don’t want to leave the loop after handling the exception you need a begin   end   pair around it