Home

Arrays

   

Introduction

with Ada.Text_IO;
use Ada.Text_IO;

procedure Exercise is
   type Numbers is array(5 .. 25) of Integer;

begin
   
end Exercise;

 

First

with Ada.Text_IO;
use Ada.Text_IO;

procedure Exercise is
   type Numbers is array(5 .. 25) of Integer;

begin
   Put_Line("Number = " & Integer'image(Numbers'First));
end Exercise;

This would produce:

Number =  5
 

Last

with Ada.Text_IO;
use Ada.Text_IO;

procedure Exercise is
   type Numbers is array(5 .. 25) of Integer;

begin
   Put_Line("Number = " & Integer'image(Numbers'Last));
end Exercise;

This would produce:

Number =  25
 

Length

with Ada.Text_IO;
use Ada.Text_IO;

procedure Exercise is
   type Numbers is array(5 .. 25) of Integer;

begin
   Put_Line("Length = " & Integer'image(Numbers'Length));
end Exercise;

This would produce:

Number =  21
 
 

 

 
 
 
 
 
   
 

Previous Copyright © 2010-2016, FunctionX Next