SlideShare a Scribd company logo
12/26/2013

ADA
PROGRAMMING
LANGUAGE
1
LIST OF CONTENTS..
12/26/2013

ADA short introduction
 Data Types
 Sub-Types
 Derived-Types
 Strongly Typed
 Dynamic Typing
 Control Structures
 Case Statements
 Loops (Conditional)


2
ADA
12/26/2013

Ada is a programming language which is suitable
for all development needs, named after Augusta
Ada King.
 Ada has built-in features that directly support:








Structured programming
Object-oriented programming
Generic programming
Distributed programming
Concurrent programming.

3
ADA FEATURES
12/26/2013

Strongly Typed
 Packages can be defined.
 Packages and types can be made generic.
 Tasks can be created and communicate.
 Predefined library
 Object-oriented programming is included.
 Interfaces to other languages are included in this
languages.


4
DATA TYPES
12/26/2013

A Type is given by a set of values and
their operations.
 Ada allows us to define our own data types,
including numeric data types.
 The elementary Ada types are:


Scalar Types
 Discrete Types
 Real Types
 Fixed Point Types
 Access Types


5
SCALAR TYPES
12/26/2013

The predefined package Standard contains
declarations for the standard types such as integer,
float, character and boolean, as well as defining the
operations available on them.
 The following operations are defined for all scalar
types.


=, /= Equality, inequality
 <, <=, >, >=
 in, not in Range membership text


6
INTEGER TYPES
12/26/2013

The following are examples of integer declarations.
 Here the standard predefined integer type is used.








Count : Integer;
X,Y,Z : Integer;
Amount : Integer := 0;
Unity : constant Integer := 1;
A_Month : Integer range 1..12;

7
INTEGER TYPES
12/26/2013



The following operators are also defined for all
integer types.






+,-,*,/
**
Mod
rem
Abs

Exponentiation (integer exponent only)
Modulus
Remainder
Absolute value

8
FLOATING POINT TYPES
12/26/2013

The following are examples of floating point
declarations.
 Floating point numbers have a relative error.


x
: float;
 a,b,c
: float;
 pi
: constant float := 3.14;
 Avogadro : constant := 6.027E23;


9
FLOATING POINT TYPES
The following operators are also defined for all float
types.
+,*,/, **
 abs

12/26/2013





Exponentiation (integer exponent only)
Absolute value

10
FIXED POINT TYPES



12/26/2013

Fixed point numbers have a bounded error, the
absolute value of which is called the delta of the
type.
 The following is example of fixed point declarations.


type Volt is delta 0.125 range 0.0 .. 255.0;

11
ENUMERATION TYPES
An enumeration type is defined by listing all the
possible values of the type.

12/26/2013



type Computer_Language is (Assembler, Cobol, Lisp,
Pascal, Ada);
 type C_Letter_Languages is (Cobol, C);




There are two predefined enumerated types in the
package STANDARD:
Type character.
 Type boolean.


12
TYPE CHARACTER
There are two built-in character types in Ada
Simple 8-bit ASCII Characters
 Wide_Character that support 16-bit Unicode/ISO
standard 10646.




12/26/2013



We can define our own types just like the integer
types


type LetterGrade is ( ‘A’, ‘B’, ‘C’, ‘D’, ‘F’, ‘I’, ‘W’);

13
TYPE BOOLEAN


The two values of boolean variables is true and false.
The following operators can be used with boolean types:














12/26/2013



and
or
not
xor
/=
=
'and then'
'or else'

Ada will not allow an unparenthesied expression to contain both
and's and or's.
This decreases the likelihood of misreading the intent
of a complicated boolean expression.
E.g.



(a < b) and (b > c) or (d < e) -- illegal
((a < b) and (b > c)) or (d < e) -- ok

14
SUB-TYPES





We can restrict the range of values a variable can take
by declaring a subtype with a restricted range of values
(this corresponds to
Pascal's user defined types).
Any attempt to place an out-of-range value into a
variable of a subtype results in an exception (program
error).
In this way program errors can be discovered. The
syntax for a subtype declaration is





12/26/2013



subtype Name is Base_Type;
subtype Name is Base_Type range lowerbound . . upperbound;

Examples of declaring subtypes are given below.


type Processors is (M68000, i8086, i80386, M68030,
Pentium, PowerPC);



subtype Old_Processors is Processors range M68000..i8086;
subtype New_Processors is Processors range
Pentium..PowerPC;

15
DERIVED-TYPES
12/26/2013

When subtypes are created they are still compatible
with their base type. Sometimes we may wish to
create distinctly new types that are not associated
with the original type at all.
 To do this we create a derived type from a parent
type using the following syntax


type Name is new Parent_Type;
 type Name is new Parent_Type range lower bound . . upper
bound;


16
DERIVED-TYPES
12/26/2013

A derived type is a completely new type and is
incompatible with any other type, even those
derived from the same parent type.
 Derived types should be used when the modeling of
a particular object suggests that the parent type is
inappropriate, or you wish to partition the objects
into distinct and unmixable classes.


type Employee_No is new Integer;
 type Account_No is new Integer range 0..999_999;


17
Ada Type

Access

Scalar

Array

Record

Discrete

Enumeration

12/26/2013

Composite Types

Elementary Types

Protected

Task

Real

Integer

Float

Fixed

18

Signed

Modular

Decimal

Ordinary
STRONGLY TYPED
12/26/2013

A strongly-typed programming language is one in which
each type of data (such as integer, character,
hexadecimal, packed decimal, and so forth) is predefined
as part of the programming language and all constants or
variables defined for a given program must be described
with one of the data types.
 Ada is a strongly typed programming language.
 A large number of compile-time checks are supported to
help avoid bugs that would not be detectable until runtime in some other languages or would require explicit
checks to be added to the source code.


19
STRONGLY TYPED
12/26/2013

For example, the syntax requires explicitly named
closing of blocks to prevent errors due to
mismatched end tokens.
 The adherence to strong typing allows detection of
many common software errors (wrong parameters,
range violations, invalid references, mismatched
types, etc.) either during compile-time, or otherwise
during run-time.
 Compilers also commonly check for misspelled
identifiers, visibility of packages, redundant
declarations, etc. and can provide warnings and
useful suggestions on how to fix the error.


20
DYNAMIC TYPING
12/26/2013

Dynamic Typing is the property of a language
where type checks are performed mostly at run
time.
 Where values in Pascal or C must be static (e.g.
the subscript bounds of an array) they may be
dynamic in Ada.
 However, static expressions are required in certain
cases where dynamic evaluation would not permit a
reasonable implementation (e.g. in setting the
number of digits of precision of a floating point
type).


21


Control Structures
Conditionals
If Statements
 Case Statements




12/26/2013



Loops

22
CONTROL STRUCTURES
12/26/2013

The control structures of Ada are similar in style to
most conventional languages. However some
differences remain.
 As usual Ada control structures are designed for
maximum readability, all control structures are
clearly ended with an 'end something'.


23
IF STATEMENTS
All if statements end with an end if statement.


if condition then

12/26/2013



statement;
else
other statement;
end if;

24




if condition then

statement;
elsif condition then
other statement;
elsif condition then
other statement;
...
else condition then
another statement;
end if;
 The final else is optional in this form of the if.

12/26/2013

To prevent the common sight of if's marching across the
page there is the elsif structure. As many elsifs as
required can used. Note the spelling of elsif carefully.

25
CASE STATEMENTS
Often it is necessary to compare one specific variable
against several constant expressions. For this kind of
conditional expression the case statement exists. For
example:
case X is
when 1 =>
Walk_The_Dog;
when 5 =>
Launch_Nuke;
when 8 | 10 =>
Sell_All_Stock;
when others =>
Self_Destruct;
end case;

12/26/2013



26
LOOPS (CONDITIONAL)
Loops allow you to have a set of statements
repeated over and over again.






12/26/2013



Endless Loop
Loop with Condition at the Beginning
loop with condition at the end
loop with condition in the middle
for loop

27
ENDLESS LOOP
as a relative term here — if the computer is
switched off then even endless loops will end very
abruptly.


12/26/2013



Endless_Loop :

loop
Do_Something;
end loop Endless_Loop;
 The loop name (in this case, "Endless_Loop") is an
optional feature of Ada.
 Naming loops is nice forreadability but not strictly
needed.

28
LOOP WITH CONDITION AT THE BEGINNING



12/26/2013

This loop has a condition at the beginning. The
statements are repeated as long as the condition is
met.
 If the condition is not met at the very beginning then
the statements inside the loop are never executed.


While_Loop :

while X <= 5 loop
X := Calculate_Something;
end loop While_Loop;
29
LOOP WITH CONDITION AT THE END



12/26/2013

This loop has a condition at the end and the
statements are repeated until the condition is met.
 Since the check is at the end the statements are at
least executed once.


Until_Loop :

loop
X := Calculate_Something;
exit Until_Loop when X > 5;
end loop Until_Loop;
30
LOOP WITH CONDITION IN THE MIDDLE



Sometimes you need to first make a calculation and exit
the loop when a certain criterion is met.
However when the criterion is not met there is
something else to be done. Hence you need a loop
where the exit condition is in the middle.




12/26/2013



Exit_Loop :

loop
X := Calculate_Something;
exit Exit_Loop when X > 5;
Do_Something (X);
end loop Exit_Loop;
In Ada the exit condition can be combined with any
other loop statement as well. We can also have more
then one exit statement.

31
FOR LOOP
Quite often one needs a loop where a specific variable is
counted from a given start value up or down to a specific end
value.









12/26/2013



For_Loop :

for I in Integer range 1 .. 10 loop
Do_Something (I)
end loop For_Loop;
You don't have to declare both type and range as seen in the
example.
If you leave out the type then the compiler will determine the
type by context and leave out the range then the loop will
iterate over every valid value for the type given.
As always with Ada: when "determine by context" gives two or
more possible options then an error will be displayed and then
you have to name the type to be used.
Ada will only do "guess-works" when it is safe to do so.

32
CONCLUSION
Ada is a huge language. It is to be remembered
that the main objective of the Ada design was to
incorporate the contemporary software engineering
knowledge. Ada is used in the areas of Air Traffic
Control Systems (in various countries), Railway
Transportation Systems (such as Paris Metro and
Hong Kong Subway) and Banking/Finance (Reuters
and others).

12/26/2013



33

More Related Content

What's hot (20)

Java basic introduction
Java basic introductionJava basic introduction
Java basic introduction
Ideal Eyes Business College
 
Dbms 11: Relational Algebra
Dbms 11: Relational AlgebraDbms 11: Relational Algebra
Dbms 11: Relational Algebra
Amiya9439793168
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
Tech_MX
 
Use Case Model
Use Case ModelUse Case Model
Use Case Model
Ali Nguyen
 
Encapsulation
EncapsulationEncapsulation
Encapsulation
baabtra.com - No. 1 supplier of quality freshers
 
Presentation on uml
Presentation on umlPresentation on uml
Presentation on uml
Shruti Dalela
 
encapsulation
encapsulationencapsulation
encapsulation
shalini392
 
Java Presentation
Java PresentationJava Presentation
Java Presentation
pm2214
 
pushdown automata
pushdown automatapushdown automata
pushdown automata
Sujata Pardeshi
 
Final project report
Final project reportFinal project report
Final project report
ssuryawanshi
 
Encapsulation and inheritance
Encapsulation and inheritanceEncapsulation and inheritance
Encapsulation and inheritance
Chaudhary Kashif
 
Java fundamentals
Java fundamentalsJava fundamentals
Java fundamentals
Jayfee Ramos
 
System protection in Operating System
System protection in Operating SystemSystem protection in Operating System
System protection in Operating System
sohaildanish
 
C language industrial training report
C language industrial training reportC language industrial training report
C language industrial training report
Raushan Pandey
 
Interface in java
Interface in javaInterface in java
Interface in java
PhD Research Scholar
 
SQL, Embedded SQL, Dynamic SQL and SQLJ
SQL, Embedded SQL, Dynamic SQL and SQLJSQL, Embedded SQL, Dynamic SQL and SQLJ
SQL, Embedded SQL, Dynamic SQL and SQLJ
Dharita Chokshi
 
OOPS In JAVA.pptx
OOPS In JAVA.pptxOOPS In JAVA.pptx
OOPS In JAVA.pptx
Sachin33417
 
Relational model
Relational modelRelational model
Relational model
Dabbal Singh Mahara
 
Lecture 7
Lecture 7Lecture 7
Lecture 7
shah zeb
 
Object Oriented programming - Introduction
Object Oriented programming - IntroductionObject Oriented programming - Introduction
Object Oriented programming - Introduction
Madishetty Prathibha
 

Viewers also liked (20)

Rails Girls Cluj: Programming in the real world
Rails Girls Cluj: Programming in the real worldRails Girls Cluj: Programming in the real world
Rails Girls Cluj: Programming in the real world
Mircea Mare
 
Ada Seminar — An Introduction to Ada
Ada Seminar — An Introduction to AdaAda Seminar — An Introduction to Ada
Ada Seminar — An Introduction to Ada
Adrian Hoe
 
Ada 2012
Ada 2012Ada 2012
Ada 2012
AdaCore
 
Webinar: Strongly Typed Languages and Flexible Schemas
Webinar: Strongly Typed Languages and Flexible SchemasWebinar: Strongly Typed Languages and Flexible Schemas
Webinar: Strongly Typed Languages and Flexible Schemas
MongoDB
 
Plc (1)
Plc (1)Plc (1)
Plc (1)
James Croft
 
Ada distilled 2005 version
Ada distilled 2005 versionAda distilled 2005 version
Ada distilled 2005 version
Osmanys Fuentes Lomba
 
Programming Languages
Programming LanguagesProgramming Languages
Programming Languages
Edward Blurock
 
Ada 95 - Programming in the large
Ada 95 - Programming in the largeAda 95 - Programming in the large
Ada 95 - Programming in the large
Gneuromante canalada.org
 
Euclid open network - Project Work at #sds2013
Euclid open network - Project Work at #sds2013Euclid open network - Project Work at #sds2013
Euclid open network - Project Work at #sds2013
Guglielmo Apolloni
 
Oop
OopOop
Oop
Jun-jun Lagman
 
GNAT GPL For Mindstorms
GNAT GPL For MindstormsGNAT GPL For Mindstorms
GNAT GPL For Mindstorms
AdaCore
 
PHP
 PHP PHP
PHP
Mohammed Hussein
 
Ada Lovelace Day - 200 anos
Ada Lovelace Day - 200 anosAda Lovelace Day - 200 anos
Ada Lovelace Day - 200 anos
Tania Andrea
 
Entrevista exclusiva tim berners lee
Entrevista exclusiva tim berners leeEntrevista exclusiva tim berners lee
Entrevista exclusiva tim berners lee
Alexandre Grolla
 
GNAT Pro User Day: Ada at Ansaldo STS
GNAT Pro User Day: Ada at Ansaldo STSGNAT Pro User Day: Ada at Ansaldo STS
GNAT Pro User Day: Ada at Ansaldo STS
AdaCore
 
GNAT Pro User Day: Ada Factory
GNAT Pro User Day: Ada FactoryGNAT Pro User Day: Ada Factory
GNAT Pro User Day: Ada Factory
AdaCore
 
GNAT Pro User Day: GNATdoc: Automatic Documentation Generator
GNAT Pro User Day: GNATdoc: Automatic Documentation GeneratorGNAT Pro User Day: GNATdoc: Automatic Documentation Generator
GNAT Pro User Day: GNATdoc: Automatic Documentation Generator
AdaCore
 
GNAT Pro User Day: New and Upcoming Developments in the AdaCore Technology
GNAT Pro User Day: New and Upcoming Developments in the AdaCore TechnologyGNAT Pro User Day: New and Upcoming Developments in the AdaCore Technology
GNAT Pro User Day: New and Upcoming Developments in the AdaCore Technology
AdaCore
 
Euclid and his contribution in development of math
Euclid and his contribution in development of mathEuclid and his contribution in development of math
Euclid and his contribution in development of math
Akshay Kumar
 
High performance fibres
High performance fibresHigh performance fibres
High performance fibres
A S M AHASANUL KABIR
 
Rails Girls Cluj: Programming in the real world
Rails Girls Cluj: Programming in the real worldRails Girls Cluj: Programming in the real world
Rails Girls Cluj: Programming in the real world
Mircea Mare
 
Ada Seminar — An Introduction to Ada
Ada Seminar — An Introduction to AdaAda Seminar — An Introduction to Ada
Ada Seminar — An Introduction to Ada
Adrian Hoe
 
Ada 2012
Ada 2012Ada 2012
Ada 2012
AdaCore
 
Webinar: Strongly Typed Languages and Flexible Schemas
Webinar: Strongly Typed Languages and Flexible SchemasWebinar: Strongly Typed Languages and Flexible Schemas
Webinar: Strongly Typed Languages and Flexible Schemas
MongoDB
 
Euclid open network - Project Work at #sds2013
Euclid open network - Project Work at #sds2013Euclid open network - Project Work at #sds2013
Euclid open network - Project Work at #sds2013
Guglielmo Apolloni
 
GNAT GPL For Mindstorms
GNAT GPL For MindstormsGNAT GPL For Mindstorms
GNAT GPL For Mindstorms
AdaCore
 
Ada Lovelace Day - 200 anos
Ada Lovelace Day - 200 anosAda Lovelace Day - 200 anos
Ada Lovelace Day - 200 anos
Tania Andrea
 
Entrevista exclusiva tim berners lee
Entrevista exclusiva tim berners leeEntrevista exclusiva tim berners lee
Entrevista exclusiva tim berners lee
Alexandre Grolla
 
GNAT Pro User Day: Ada at Ansaldo STS
GNAT Pro User Day: Ada at Ansaldo STSGNAT Pro User Day: Ada at Ansaldo STS
GNAT Pro User Day: Ada at Ansaldo STS
AdaCore
 
GNAT Pro User Day: Ada Factory
GNAT Pro User Day: Ada FactoryGNAT Pro User Day: Ada Factory
GNAT Pro User Day: Ada Factory
AdaCore
 
GNAT Pro User Day: GNATdoc: Automatic Documentation Generator
GNAT Pro User Day: GNATdoc: Automatic Documentation GeneratorGNAT Pro User Day: GNATdoc: Automatic Documentation Generator
GNAT Pro User Day: GNATdoc: Automatic Documentation Generator
AdaCore
 
GNAT Pro User Day: New and Upcoming Developments in the AdaCore Technology
GNAT Pro User Day: New and Upcoming Developments in the AdaCore TechnologyGNAT Pro User Day: New and Upcoming Developments in the AdaCore Technology
GNAT Pro User Day: New and Upcoming Developments in the AdaCore Technology
AdaCore
 
Euclid and his contribution in development of math
Euclid and his contribution in development of mathEuclid and his contribution in development of math
Euclid and his contribution in development of math
Akshay Kumar
 

Similar to ADA programming language (20)

Hema wt (1)
Hema wt (1)Hema wt (1)
Hema wt (1)
SangeethaSasi1
 
Tech Days 2015: A quick tour of Ada 2012
Tech Days 2015: A quick tour of Ada 2012Tech Days 2015: A quick tour of Ada 2012
Tech Days 2015: A quick tour of Ada 2012
AdaCore
 
pl10ch6_datatypesprinciplesof programing.ppt
pl10ch6_datatypesprinciplesof programing.pptpl10ch6_datatypesprinciplesof programing.ppt
pl10ch6_datatypesprinciplesof programing.ppt
vimalgaur7
 
6 data types
6 data types6 data types
6 data types
Munawar Ahmed
 
An Introduction to ADA.pptx
An Introduction to ADA.pptxAn Introduction to ADA.pptx
An Introduction to ADA.pptx
MuhammadAwaisQureshi6
 
Desired language characteristics – Data typing .pptx
Desired language characteristics – Data typing .pptxDesired language characteristics – Data typing .pptx
Desired language characteristics – Data typing .pptx
4132lenin6497ram
 
14-types.ppt
14-types.ppt14-types.ppt
14-types.ppt
DhineshS45
 
Unit 2 Principles of Programming Languages
Unit 2 Principles of Programming LanguagesUnit 2 Principles of Programming Languages
Unit 2 Principles of Programming Languages
Vasavi College of Engg
 
What You Can Learn from Obscure Programming Languages
What You Can Learn from Obscure Programming LanguagesWhat You Can Learn from Obscure Programming Languages
What You Can Learn from Obscure Programming Languages
Dmitry Zinoviev
 
6 data types
6 data types6 data types
6 data types
jigeno
 
ch6-Short.ppt eee cse www rrr www qqq rrr ttt
ch6-Short.ppt eee cse www rrr www qqq rrr tttch6-Short.ppt eee cse www rrr www qqq rrr ttt
ch6-Short.ppt eee cse www rrr www qqq rrr ttt
winimag331
 
Boogie 2011 Hi-Lite
Boogie 2011 Hi-LiteBoogie 2011 Hi-Lite
Boogie 2011 Hi-Lite
AdaCore
 
types
typestypes
types
Rajendran
 
Embedded C - Lecture 2
Embedded C - Lecture 2Embedded C - Lecture 2
Embedded C - Lecture 2
Mohamed Abdallah
 
C programming_MSBTE_Diploma_Pranoti Doke
C programming_MSBTE_Diploma_Pranoti DokeC programming_MSBTE_Diploma_Pranoti Doke
C programming_MSBTE_Diploma_Pranoti Doke
Pranoti Doke
 
chapter 1 Introduction to Ds and Algorithm Anyasis.pptx
chapter 1 Introduction to Ds and Algorithm Anyasis.pptxchapter 1 Introduction to Ds and Algorithm Anyasis.pptx
chapter 1 Introduction to Ds and Algorithm Anyasis.pptx
AmrutaNavale2
 
Ch6.ppt
Ch6.pptCh6.ppt
Ch6.ppt
daniloalbay1
 
Example PseudocodeProblem Given a sorted array a with n elements .docx
Example PseudocodeProblem Given a sorted array a with n elements .docxExample PseudocodeProblem Given a sorted array a with n elements .docx
Example PseudocodeProblem Given a sorted array a with n elements .docx
elbanglis
 
TAPASH kumar das its my college pptasjhk
TAPASH kumar das its my college pptasjhkTAPASH kumar das its my college pptasjhk
TAPASH kumar das its my college pptasjhk
destroyer7992
 
Introduction to ‘C’ Language
Introduction to ‘C’ LanguageIntroduction to ‘C’ Language
Introduction to ‘C’ Language
Thesis Scientist Private Limited
 
Tech Days 2015: A quick tour of Ada 2012
Tech Days 2015: A quick tour of Ada 2012Tech Days 2015: A quick tour of Ada 2012
Tech Days 2015: A quick tour of Ada 2012
AdaCore
 
pl10ch6_datatypesprinciplesof programing.ppt
pl10ch6_datatypesprinciplesof programing.pptpl10ch6_datatypesprinciplesof programing.ppt
pl10ch6_datatypesprinciplesof programing.ppt
vimalgaur7
 
Desired language characteristics – Data typing .pptx
Desired language characteristics – Data typing .pptxDesired language characteristics – Data typing .pptx
Desired language characteristics – Data typing .pptx
4132lenin6497ram
 
Unit 2 Principles of Programming Languages
Unit 2 Principles of Programming LanguagesUnit 2 Principles of Programming Languages
Unit 2 Principles of Programming Languages
Vasavi College of Engg
 
What You Can Learn from Obscure Programming Languages
What You Can Learn from Obscure Programming LanguagesWhat You Can Learn from Obscure Programming Languages
What You Can Learn from Obscure Programming Languages
Dmitry Zinoviev
 
6 data types
6 data types6 data types
6 data types
jigeno
 
ch6-Short.ppt eee cse www rrr www qqq rrr ttt
ch6-Short.ppt eee cse www rrr www qqq rrr tttch6-Short.ppt eee cse www rrr www qqq rrr ttt
ch6-Short.ppt eee cse www rrr www qqq rrr ttt
winimag331
 
Boogie 2011 Hi-Lite
Boogie 2011 Hi-LiteBoogie 2011 Hi-Lite
Boogie 2011 Hi-Lite
AdaCore
 
C programming_MSBTE_Diploma_Pranoti Doke
C programming_MSBTE_Diploma_Pranoti DokeC programming_MSBTE_Diploma_Pranoti Doke
C programming_MSBTE_Diploma_Pranoti Doke
Pranoti Doke
 
chapter 1 Introduction to Ds and Algorithm Anyasis.pptx
chapter 1 Introduction to Ds and Algorithm Anyasis.pptxchapter 1 Introduction to Ds and Algorithm Anyasis.pptx
chapter 1 Introduction to Ds and Algorithm Anyasis.pptx
AmrutaNavale2
 
Example PseudocodeProblem Given a sorted array a with n elements .docx
Example PseudocodeProblem Given a sorted array a with n elements .docxExample PseudocodeProblem Given a sorted array a with n elements .docx
Example PseudocodeProblem Given a sorted array a with n elements .docx
elbanglis
 
TAPASH kumar das its my college pptasjhk
TAPASH kumar das its my college pptasjhkTAPASH kumar das its my college pptasjhk
TAPASH kumar das its my college pptasjhk
destroyer7992
 

More from Aisha Kalsoom (12)

Neural Network Based Brain Tumor Detection using MR Images
Neural Network Based Brain Tumor Detection using MR ImagesNeural Network Based Brain Tumor Detection using MR Images
Neural Network Based Brain Tumor Detection using MR Images
Aisha Kalsoom
 
Name Entity Recognition problems in biomedical literature
Name Entity Recognition problems in biomedical literatureName Entity Recognition problems in biomedical literature
Name Entity Recognition problems in biomedical literature
Aisha Kalsoom
 
An Efficient Decentralized Load Balancing Algorithm in Cloud Computing
An Efficient Decentralized Load Balancing Algorithm in Cloud ComputingAn Efficient Decentralized Load Balancing Algorithm in Cloud Computing
An Efficient Decentralized Load Balancing Algorithm in Cloud Computing
Aisha Kalsoom
 
Insilico comparative analysis of critical residues of CSN gene in 41 mammals:...
Insilico comparative analysis of critical residues of CSN gene in 41 mammals:...Insilico comparative analysis of critical residues of CSN gene in 41 mammals:...
Insilico comparative analysis of critical residues of CSN gene in 41 mammals:...
Aisha Kalsoom
 
Protein
ProteinProtein
Protein
Aisha Kalsoom
 
Medical implication of developmental biology
Medical implication of developmental biologyMedical implication of developmental biology
Medical implication of developmental biology
Aisha Kalsoom
 
Ugene Bioinformatics software
Ugene Bioinformatics softwareUgene Bioinformatics software
Ugene Bioinformatics software
Aisha Kalsoom
 
Bioinformatics and functional genomics
Bioinformatics and functional genomicsBioinformatics and functional genomics
Bioinformatics and functional genomics
Aisha Kalsoom
 
Post-Translational Modifications
Post-Translational ModificationsPost-Translational Modifications
Post-Translational Modifications
Aisha Kalsoom
 
Employee Motivation
Employee MotivationEmployee Motivation
Employee Motivation
Aisha Kalsoom
 
Polymerase chain reaction
Polymerase chain reactionPolymerase chain reaction
Polymerase chain reaction
Aisha Kalsoom
 
Psychology
PsychologyPsychology
Psychology
Aisha Kalsoom
 
Neural Network Based Brain Tumor Detection using MR Images
Neural Network Based Brain Tumor Detection using MR ImagesNeural Network Based Brain Tumor Detection using MR Images
Neural Network Based Brain Tumor Detection using MR Images
Aisha Kalsoom
 
Name Entity Recognition problems in biomedical literature
Name Entity Recognition problems in biomedical literatureName Entity Recognition problems in biomedical literature
Name Entity Recognition problems in biomedical literature
Aisha Kalsoom
 
An Efficient Decentralized Load Balancing Algorithm in Cloud Computing
An Efficient Decentralized Load Balancing Algorithm in Cloud ComputingAn Efficient Decentralized Load Balancing Algorithm in Cloud Computing
An Efficient Decentralized Load Balancing Algorithm in Cloud Computing
Aisha Kalsoom
 
Insilico comparative analysis of critical residues of CSN gene in 41 mammals:...
Insilico comparative analysis of critical residues of CSN gene in 41 mammals:...Insilico comparative analysis of critical residues of CSN gene in 41 mammals:...
Insilico comparative analysis of critical residues of CSN gene in 41 mammals:...
Aisha Kalsoom
 
Medical implication of developmental biology
Medical implication of developmental biologyMedical implication of developmental biology
Medical implication of developmental biology
Aisha Kalsoom
 
Ugene Bioinformatics software
Ugene Bioinformatics softwareUgene Bioinformatics software
Ugene Bioinformatics software
Aisha Kalsoom
 
Bioinformatics and functional genomics
Bioinformatics and functional genomicsBioinformatics and functional genomics
Bioinformatics and functional genomics
Aisha Kalsoom
 
Post-Translational Modifications
Post-Translational ModificationsPost-Translational Modifications
Post-Translational Modifications
Aisha Kalsoom
 
Polymerase chain reaction
Polymerase chain reactionPolymerase chain reaction
Polymerase chain reaction
Aisha Kalsoom
 

Recently uploaded (20)

Combustion in Compression Ignition Engine (CIE)
Combustion in Compression Ignition Engine (CIE)Combustion in Compression Ignition Engine (CIE)
Combustion in Compression Ignition Engine (CIE)
NileshKumbhar21
 
Taxonomy and Systematics: Classification and Diversity of Insects.pptx
Taxonomy and Systematics: Classification and Diversity of Insects.pptxTaxonomy and Systematics: Classification and Diversity of Insects.pptx
Taxonomy and Systematics: Classification and Diversity of Insects.pptx
Arshad Shaikh
 
Unit 4 Reverse Engineering Tools Functionalities & Use-Cases.pdf
Unit 4  Reverse Engineering Tools  Functionalities & Use-Cases.pdfUnit 4  Reverse Engineering Tools  Functionalities & Use-Cases.pdf
Unit 4 Reverse Engineering Tools Functionalities & Use-Cases.pdf
ChatanBawankar
 
QUIZ-O-FORCE 3.0 FINAL SET BY SOURAV .pptx
QUIZ-O-FORCE 3.0 FINAL SET BY SOURAV .pptxQUIZ-O-FORCE 3.0 FINAL SET BY SOURAV .pptx
QUIZ-O-FORCE 3.0 FINAL SET BY SOURAV .pptx
Sourav Kr Podder
 
The Splitting of the Moon (Shaqq al-Qamar).pdf
The Splitting of the Moon (Shaqq al-Qamar).pdfThe Splitting of the Moon (Shaqq al-Qamar).pdf
The Splitting of the Moon (Shaqq al-Qamar).pdf
Mirza Gazanfar Ali Baig
 
KNN,Weighted KNN,Nearest Centroid Classifier,Locally Weighted Regression
KNN,Weighted KNN,Nearest Centroid Classifier,Locally Weighted RegressionKNN,Weighted KNN,Nearest Centroid Classifier,Locally Weighted Regression
KNN,Weighted KNN,Nearest Centroid Classifier,Locally Weighted Regression
Global Academy of Technology
 
Unit 1 Kali NetHunter is the official Kali Linux penetration testing platform...
Unit 1 Kali NetHunter is the official Kali Linux penetration testing platform...Unit 1 Kali NetHunter is the official Kali Linux penetration testing platform...
Unit 1 Kali NetHunter is the official Kali Linux penetration testing platform...
ChatanBawankar
 
TechSoup Introduction to Generative AI and Copilot - 2025.05.22.pdf
TechSoup Introduction to Generative AI and Copilot - 2025.05.22.pdfTechSoup Introduction to Generative AI and Copilot - 2025.05.22.pdf
TechSoup Introduction to Generative AI and Copilot - 2025.05.22.pdf
TechSoup
 
How to create Record rules in odoo 18 - Odoo Slides
How to create Record rules in odoo 18 - Odoo  SlidesHow to create Record rules in odoo 18 - Odoo  Slides
How to create Record rules in odoo 18 - Odoo Slides
Celine George
 
Odoo 18 Point of Sale PWA - Odoo Slides
Odoo 18 Point of Sale PWA  - Odoo  SlidesOdoo 18 Point of Sale PWA  - Odoo  Slides
Odoo 18 Point of Sale PWA - Odoo Slides
Celine George
 
Paper 110A | Shadows and Light: Exploring Expressionism in ‘The Cabinet of Dr...
Paper 110A | Shadows and Light: Exploring Expressionism in ‘The Cabinet of Dr...Paper 110A | Shadows and Light: Exploring Expressionism in ‘The Cabinet of Dr...
Paper 110A | Shadows and Light: Exploring Expressionism in ‘The Cabinet of Dr...
Rajdeep Bavaliya
 
0b - THE ROMANTIC ERA: FEELINGS AND IDENTITY.pptx
0b - THE ROMANTIC ERA: FEELINGS AND IDENTITY.pptx0b - THE ROMANTIC ERA: FEELINGS AND IDENTITY.pptx
0b - THE ROMANTIC ERA: FEELINGS AND IDENTITY.pptx
Julián Jesús Pérez Fernández
 
5503 Course Proposal Online Computer Middle School Course Wood M.pdf
5503 Course Proposal Online Computer Middle School Course Wood M.pdf5503 Course Proposal Online Computer Middle School Course Wood M.pdf
5503 Course Proposal Online Computer Middle School Course Wood M.pdf
Melanie Wood
 
Salinity Resistance in Plants.Rice plant
Salinity Resistance in Plants.Rice plantSalinity Resistance in Plants.Rice plant
Salinity Resistance in Plants.Rice plant
aliabatool11
 
[2025] Qualtric XM-EX-EXPERT Study Plan | Practice Questions + Exam Details
[2025] Qualtric XM-EX-EXPERT Study Plan | Practice Questions + Exam Details[2025] Qualtric XM-EX-EXPERT Study Plan | Practice Questions + Exam Details
[2025] Qualtric XM-EX-EXPERT Study Plan | Practice Questions + Exam Details
Jenny408767
 
Geographical-Diversity-of-India.pptx/7th class /new ncert /samyans academy
Geographical-Diversity-of-India.pptx/7th class /new ncert /samyans academyGeographical-Diversity-of-India.pptx/7th class /new ncert /samyans academy
Geographical-Diversity-of-India.pptx/7th class /new ncert /samyans academy
Sandeep Swamy
 
Regression Analysis-Machine Learning -Different Types
Regression Analysis-Machine Learning -Different TypesRegression Analysis-Machine Learning -Different Types
Regression Analysis-Machine Learning -Different Types
Global Academy of Technology
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-21-2025.pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 5-21-2025.pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 5-21-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-21-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
siemaillard
 
Optical and non optical devices used in low vision
Optical and non optical devices used in low visionOptical and non optical devices used in low vision
Optical and non optical devices used in low vision
Aligarh Muslim University, Aligarh, Uttar Pradesh, India
 
Combustion in Compression Ignition Engine (CIE)
Combustion in Compression Ignition Engine (CIE)Combustion in Compression Ignition Engine (CIE)
Combustion in Compression Ignition Engine (CIE)
NileshKumbhar21
 
Taxonomy and Systematics: Classification and Diversity of Insects.pptx
Taxonomy and Systematics: Classification and Diversity of Insects.pptxTaxonomy and Systematics: Classification and Diversity of Insects.pptx
Taxonomy and Systematics: Classification and Diversity of Insects.pptx
Arshad Shaikh
 
Unit 4 Reverse Engineering Tools Functionalities & Use-Cases.pdf
Unit 4  Reverse Engineering Tools  Functionalities & Use-Cases.pdfUnit 4  Reverse Engineering Tools  Functionalities & Use-Cases.pdf
Unit 4 Reverse Engineering Tools Functionalities & Use-Cases.pdf
ChatanBawankar
 
QUIZ-O-FORCE 3.0 FINAL SET BY SOURAV .pptx
QUIZ-O-FORCE 3.0 FINAL SET BY SOURAV .pptxQUIZ-O-FORCE 3.0 FINAL SET BY SOURAV .pptx
QUIZ-O-FORCE 3.0 FINAL SET BY SOURAV .pptx
Sourav Kr Podder
 
The Splitting of the Moon (Shaqq al-Qamar).pdf
The Splitting of the Moon (Shaqq al-Qamar).pdfThe Splitting of the Moon (Shaqq al-Qamar).pdf
The Splitting of the Moon (Shaqq al-Qamar).pdf
Mirza Gazanfar Ali Baig
 
KNN,Weighted KNN,Nearest Centroid Classifier,Locally Weighted Regression
KNN,Weighted KNN,Nearest Centroid Classifier,Locally Weighted RegressionKNN,Weighted KNN,Nearest Centroid Classifier,Locally Weighted Regression
KNN,Weighted KNN,Nearest Centroid Classifier,Locally Weighted Regression
Global Academy of Technology
 
Unit 1 Kali NetHunter is the official Kali Linux penetration testing platform...
Unit 1 Kali NetHunter is the official Kali Linux penetration testing platform...Unit 1 Kali NetHunter is the official Kali Linux penetration testing platform...
Unit 1 Kali NetHunter is the official Kali Linux penetration testing platform...
ChatanBawankar
 
TechSoup Introduction to Generative AI and Copilot - 2025.05.22.pdf
TechSoup Introduction to Generative AI and Copilot - 2025.05.22.pdfTechSoup Introduction to Generative AI and Copilot - 2025.05.22.pdf
TechSoup Introduction to Generative AI and Copilot - 2025.05.22.pdf
TechSoup
 
How to create Record rules in odoo 18 - Odoo Slides
How to create Record rules in odoo 18 - Odoo  SlidesHow to create Record rules in odoo 18 - Odoo  Slides
How to create Record rules in odoo 18 - Odoo Slides
Celine George
 
Odoo 18 Point of Sale PWA - Odoo Slides
Odoo 18 Point of Sale PWA  - Odoo  SlidesOdoo 18 Point of Sale PWA  - Odoo  Slides
Odoo 18 Point of Sale PWA - Odoo Slides
Celine George
 
Paper 110A | Shadows and Light: Exploring Expressionism in ‘The Cabinet of Dr...
Paper 110A | Shadows and Light: Exploring Expressionism in ‘The Cabinet of Dr...Paper 110A | Shadows and Light: Exploring Expressionism in ‘The Cabinet of Dr...
Paper 110A | Shadows and Light: Exploring Expressionism in ‘The Cabinet of Dr...
Rajdeep Bavaliya
 
5503 Course Proposal Online Computer Middle School Course Wood M.pdf
5503 Course Proposal Online Computer Middle School Course Wood M.pdf5503 Course Proposal Online Computer Middle School Course Wood M.pdf
5503 Course Proposal Online Computer Middle School Course Wood M.pdf
Melanie Wood
 
Salinity Resistance in Plants.Rice plant
Salinity Resistance in Plants.Rice plantSalinity Resistance in Plants.Rice plant
Salinity Resistance in Plants.Rice plant
aliabatool11
 
[2025] Qualtric XM-EX-EXPERT Study Plan | Practice Questions + Exam Details
[2025] Qualtric XM-EX-EXPERT Study Plan | Practice Questions + Exam Details[2025] Qualtric XM-EX-EXPERT Study Plan | Practice Questions + Exam Details
[2025] Qualtric XM-EX-EXPERT Study Plan | Practice Questions + Exam Details
Jenny408767
 
Geographical-Diversity-of-India.pptx/7th class /new ncert /samyans academy
Geographical-Diversity-of-India.pptx/7th class /new ncert /samyans academyGeographical-Diversity-of-India.pptx/7th class /new ncert /samyans academy
Geographical-Diversity-of-India.pptx/7th class /new ncert /samyans academy
Sandeep Swamy
 
Regression Analysis-Machine Learning -Different Types
Regression Analysis-Machine Learning -Different TypesRegression Analysis-Machine Learning -Different Types
Regression Analysis-Machine Learning -Different Types
Global Academy of Technology
 
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
siemaillard
 

ADA programming language

  • 2. LIST OF CONTENTS.. 12/26/2013 ADA short introduction  Data Types  Sub-Types  Derived-Types  Strongly Typed  Dynamic Typing  Control Structures  Case Statements  Loops (Conditional)  2
  • 3. ADA 12/26/2013 Ada is a programming language which is suitable for all development needs, named after Augusta Ada King.  Ada has built-in features that directly support:       Structured programming Object-oriented programming Generic programming Distributed programming Concurrent programming. 3
  • 4. ADA FEATURES 12/26/2013 Strongly Typed  Packages can be defined.  Packages and types can be made generic.  Tasks can be created and communicate.  Predefined library  Object-oriented programming is included.  Interfaces to other languages are included in this languages.  4
  • 5. DATA TYPES 12/26/2013 A Type is given by a set of values and their operations.  Ada allows us to define our own data types, including numeric data types.  The elementary Ada types are:  Scalar Types  Discrete Types  Real Types  Fixed Point Types  Access Types  5
  • 6. SCALAR TYPES 12/26/2013 The predefined package Standard contains declarations for the standard types such as integer, float, character and boolean, as well as defining the operations available on them.  The following operations are defined for all scalar types.  =, /= Equality, inequality  <, <=, >, >=  in, not in Range membership text  6
  • 7. INTEGER TYPES 12/26/2013 The following are examples of integer declarations.  Here the standard predefined integer type is used.       Count : Integer; X,Y,Z : Integer; Amount : Integer := 0; Unity : constant Integer := 1; A_Month : Integer range 1..12; 7
  • 8. INTEGER TYPES 12/26/2013  The following operators are also defined for all integer types.      +,-,*,/ ** Mod rem Abs Exponentiation (integer exponent only) Modulus Remainder Absolute value 8
  • 9. FLOATING POINT TYPES 12/26/2013 The following are examples of floating point declarations.  Floating point numbers have a relative error.  x : float;  a,b,c : float;  pi : constant float := 3.14;  Avogadro : constant := 6.027E23;  9
  • 10. FLOATING POINT TYPES The following operators are also defined for all float types. +,*,/, **  abs 12/26/2013   Exponentiation (integer exponent only) Absolute value 10
  • 11. FIXED POINT TYPES  12/26/2013 Fixed point numbers have a bounded error, the absolute value of which is called the delta of the type.  The following is example of fixed point declarations.  type Volt is delta 0.125 range 0.0 .. 255.0; 11
  • 12. ENUMERATION TYPES An enumeration type is defined by listing all the possible values of the type. 12/26/2013  type Computer_Language is (Assembler, Cobol, Lisp, Pascal, Ada);  type C_Letter_Languages is (Cobol, C);   There are two predefined enumerated types in the package STANDARD: Type character.  Type boolean.  12
  • 13. TYPE CHARACTER There are two built-in character types in Ada Simple 8-bit ASCII Characters  Wide_Character that support 16-bit Unicode/ISO standard 10646.   12/26/2013  We can define our own types just like the integer types  type LetterGrade is ( ‘A’, ‘B’, ‘C’, ‘D’, ‘F’, ‘I’, ‘W’); 13
  • 14. TYPE BOOLEAN  The two values of boolean variables is true and false. The following operators can be used with boolean types:            12/26/2013  and or not xor /= = 'and then' 'or else' Ada will not allow an unparenthesied expression to contain both and's and or's. This decreases the likelihood of misreading the intent of a complicated boolean expression. E.g.   (a < b) and (b > c) or (d < e) -- illegal ((a < b) and (b > c)) or (d < e) -- ok 14
  • 15. SUB-TYPES   We can restrict the range of values a variable can take by declaring a subtype with a restricted range of values (this corresponds to Pascal's user defined types). Any attempt to place an out-of-range value into a variable of a subtype results in an exception (program error). In this way program errors can be discovered. The syntax for a subtype declaration is    12/26/2013  subtype Name is Base_Type; subtype Name is Base_Type range lowerbound . . upperbound; Examples of declaring subtypes are given below.  type Processors is (M68000, i8086, i80386, M68030, Pentium, PowerPC);   subtype Old_Processors is Processors range M68000..i8086; subtype New_Processors is Processors range Pentium..PowerPC; 15
  • 16. DERIVED-TYPES 12/26/2013 When subtypes are created they are still compatible with their base type. Sometimes we may wish to create distinctly new types that are not associated with the original type at all.  To do this we create a derived type from a parent type using the following syntax  type Name is new Parent_Type;  type Name is new Parent_Type range lower bound . . upper bound;  16
  • 17. DERIVED-TYPES 12/26/2013 A derived type is a completely new type and is incompatible with any other type, even those derived from the same parent type.  Derived types should be used when the modeling of a particular object suggests that the parent type is inappropriate, or you wish to partition the objects into distinct and unmixable classes.  type Employee_No is new Integer;  type Account_No is new Integer range 0..999_999;  17
  • 18. Ada Type Access Scalar Array Record Discrete Enumeration 12/26/2013 Composite Types Elementary Types Protected Task Real Integer Float Fixed 18 Signed Modular Decimal Ordinary
  • 19. STRONGLY TYPED 12/26/2013 A strongly-typed programming language is one in which each type of data (such as integer, character, hexadecimal, packed decimal, and so forth) is predefined as part of the programming language and all constants or variables defined for a given program must be described with one of the data types.  Ada is a strongly typed programming language.  A large number of compile-time checks are supported to help avoid bugs that would not be detectable until runtime in some other languages or would require explicit checks to be added to the source code.  19
  • 20. STRONGLY TYPED 12/26/2013 For example, the syntax requires explicitly named closing of blocks to prevent errors due to mismatched end tokens.  The adherence to strong typing allows detection of many common software errors (wrong parameters, range violations, invalid references, mismatched types, etc.) either during compile-time, or otherwise during run-time.  Compilers also commonly check for misspelled identifiers, visibility of packages, redundant declarations, etc. and can provide warnings and useful suggestions on how to fix the error.  20
  • 21. DYNAMIC TYPING 12/26/2013 Dynamic Typing is the property of a language where type checks are performed mostly at run time.  Where values in Pascal or C must be static (e.g. the subscript bounds of an array) they may be dynamic in Ada.  However, static expressions are required in certain cases where dynamic evaluation would not permit a reasonable implementation (e.g. in setting the number of digits of precision of a floating point type).  21
  • 22.  Control Structures Conditionals If Statements  Case Statements   12/26/2013  Loops 22
  • 23. CONTROL STRUCTURES 12/26/2013 The control structures of Ada are similar in style to most conventional languages. However some differences remain.  As usual Ada control structures are designed for maximum readability, all control structures are clearly ended with an 'end something'.  23
  • 24. IF STATEMENTS All if statements end with an end if statement.  if condition then 12/26/2013  statement; else other statement; end if; 24
  • 25.   if condition then statement; elsif condition then other statement; elsif condition then other statement; ... else condition then another statement; end if;  The final else is optional in this form of the if. 12/26/2013 To prevent the common sight of if's marching across the page there is the elsif structure. As many elsifs as required can used. Note the spelling of elsif carefully. 25
  • 26. CASE STATEMENTS Often it is necessary to compare one specific variable against several constant expressions. For this kind of conditional expression the case statement exists. For example: case X is when 1 => Walk_The_Dog; when 5 => Launch_Nuke; when 8 | 10 => Sell_All_Stock; when others => Self_Destruct; end case; 12/26/2013  26
  • 27. LOOPS (CONDITIONAL) Loops allow you to have a set of statements repeated over and over again.      12/26/2013  Endless Loop Loop with Condition at the Beginning loop with condition at the end loop with condition in the middle for loop 27
  • 28. ENDLESS LOOP as a relative term here — if the computer is switched off then even endless loops will end very abruptly.  12/26/2013  Endless_Loop : loop Do_Something; end loop Endless_Loop;  The loop name (in this case, "Endless_Loop") is an optional feature of Ada.  Naming loops is nice forreadability but not strictly needed. 28
  • 29. LOOP WITH CONDITION AT THE BEGINNING  12/26/2013 This loop has a condition at the beginning. The statements are repeated as long as the condition is met.  If the condition is not met at the very beginning then the statements inside the loop are never executed.  While_Loop : while X <= 5 loop X := Calculate_Something; end loop While_Loop; 29
  • 30. LOOP WITH CONDITION AT THE END  12/26/2013 This loop has a condition at the end and the statements are repeated until the condition is met.  Since the check is at the end the statements are at least executed once.  Until_Loop : loop X := Calculate_Something; exit Until_Loop when X > 5; end loop Until_Loop; 30
  • 31. LOOP WITH CONDITION IN THE MIDDLE  Sometimes you need to first make a calculation and exit the loop when a certain criterion is met. However when the criterion is not met there is something else to be done. Hence you need a loop where the exit condition is in the middle.   12/26/2013  Exit_Loop : loop X := Calculate_Something; exit Exit_Loop when X > 5; Do_Something (X); end loop Exit_Loop; In Ada the exit condition can be combined with any other loop statement as well. We can also have more then one exit statement. 31
  • 32. FOR LOOP Quite often one needs a loop where a specific variable is counted from a given start value up or down to a specific end value.      12/26/2013  For_Loop : for I in Integer range 1 .. 10 loop Do_Something (I) end loop For_Loop; You don't have to declare both type and range as seen in the example. If you leave out the type then the compiler will determine the type by context and leave out the range then the loop will iterate over every valid value for the type given. As always with Ada: when "determine by context" gives two or more possible options then an error will be displayed and then you have to name the type to be used. Ada will only do "guess-works" when it is safe to do so. 32
  • 33. CONCLUSION Ada is a huge language. It is to be remembered that the main objective of the Ada design was to incorporate the contemporary software engineering knowledge. Ada is used in the areas of Air Traffic Control Systems (in various countries), Railway Transportation Systems (such as Paris Metro and Hong Kong Subway) and Banking/Finance (Reuters and others). 12/26/2013  33