-- CS 1621 Fall 2005 -- Record Variants in Ada with TEXT_IO; use TEXT_IO; procedure variant is package int_io is new integer_io(integer); use int_io; package fl_io is new float_io(float); use fl_io; type flint (is_int: boolean := true) is record case is_int is when true => ispot: integer; when false => rspot: float; end case; end record; flariable: flint; begin flariable := (is_int => true, rspot => 100.0); put(flariable.ispot); -- put(flariable.rspot); -- will produce run-time error -- (i.e. exception) flariable := (is_int => false, rspot => 3.456); put(flariable.rspot); end;