






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
An introduction to various programming concepts in ada, including arrays, record declaration, discriminated types, access types, and control structures such as if statements and case statements. It explains the differences between union types in c and discriminated types in ada, and demonstrates how to declare and use access types. The document also covers the syntax and usage of if statements, case statements, and other control structures.
Typology: Slides
1 / 11
This page cannot be seen from the preview
Don't miss anything!
type Int_Buffer is array (1..10) of Integer;
type Normalized_Distribution is array (-100..100) of Natural;
type String is array (Positive range <>) of Character; Last_Name : String(1..20);
type Days is (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday); type Daily_Sales is array (Days) of Float;
type Address is record Street : Unbounded_String; City : Unbounded_String; Postal_Code : String(1..10); end record ;
My_Address : Address; My_Address.Postal_Code := “00000-0000”;
type IF is (Int, Float); type Int_Float (V : IF := Int) is record case V is when Int => Int_Val : Integer; when Float => Float_Val : Float; end case ; end record ;
Puzzle : Int_Float; … Puzzle := (Float, 1.0); F := Puzzle.Float_Val; -- OK I := Puzzle.Int_Val; -- raises exception … Puzzle.V := SomeIntValue; -- not allowed!
if condition then -- any number of statement(s) end if ;
if condition1 then -- statement(s) elsif condition2 then if condition3 then -- statements end if -- statement(s) … else -- statement(s) end if ;
Boolean expression
case expression is when choice list => sequence-of-statements when choice list => sequence-of-statements when others => sequence-of-statements end case;
case TODAY is when MON .. THU => WORK; when FRI => WORK; PARTY; when SAT | SUN => REST; end case;