Your First Ada Program
220 likes | 365 Vues
Discover the fundamentals of Ada programming with Quentin Ochem. This guide covers the basics of writing your first Ada program, including variable declaration, assignment, and the use of equality operators. Learn how to transform values between types, utilize attributes, and manage input/output with Ada.Text_IO functions like Get_Line and Put_Line. Understand control flow using if-then statements and the significance of begin and end identifiers in structuring your code. Ideal for beginners looking to start their journey in Ada programming.
Your First Ada Program
E N D
Presentation Transcript
Your First Ada Program Presented by Quentin Ochem University.adacore.com
Main subprogram name (can be any Ada identifier) End of main name (optional)
The Ada equality operator is = The Ada assignment is :=
Value is an attribute transforming a String to a value of a type Image is an attribute transforming a value of a type to a String
with allow to use a library unit, here Ada.Text_IO for textual functions
Get_Line reads a line on the command line Put_Line prints text on the command line
if … then delimitates a decision, no need for parenthesis elsif introduces an alternative decision
Image converts a number into a string,Value would convert a string to a number
A is not a String, need to be converted through Integer’Image (A)