Tutorial by Examples

Ada 2012(TC-1) with Ada.Text_IO; procedure Main is type Some_Float digits 8 range 0.0 .. 10.0; X : Some_Float := 2.71; begin Ada.Text_IO.Put_Line (X'Image); end Main; Result 2.71000E+00
Ada 2012(TC-1) with Ada.Text_IO; procedure Main is type Some_Integer is range -42 .. 42; X : Some_Integer := 17; begin Ada.Text_IO.Put_Line (X'Image); end Main; Result 17
Ada 2012(TC-1) with Ada.Text_IO; procedure Main is type Fruit is (Banana, Orange, Pear); X : Fruit := Orange; begin Ada.Text_IO.Put_Line (X'Image); Ada.Text_IO.Put_Line (Pear'Image); end Main; Result ORANGE PEAR
with Ada.Text_IO; procedure Main is type Fruit is (Banana, Orange, Pear); X : Fruit := Orange; begin Ada.Text_IO.Put_Line (Fruit'Image (X)); end Main; Result ORANGE
with Ada.Text_IO; procedure Main is X : Integer := 17; begin Ada.Text_IO.Put_Line (Integer'Image (X)); end Main; Result 17
with Ada.Text_IO; procedure Main is X : Float := 2.71; begin Ada.Text_IO.Put_Line (Float'Image (X)); end Main; Result 2.71000E+00
with Ada.Text_IO; procedure Image_And_Value is type Fruit is (Banana, Orange, Pear); X : Fruit := Orange; begin Ada.Text_IO.Put_Line (Boolean'Image (Fruit'Value (Fruit'Image (X)) = X and Fruit'Image (Fruit'Value ("ORANGE")) = "ORANGE"));...

Page 1 of 1