logo image

Ada Hello World! 

Ada Hello World! 

   
   

Output:

Click on RUN button to see the output

Ada online compiler

Write, Run & Share Ada code online using OneCompiler's Ada online compiler for free. It's one of the robust, feature-rich online compilers for Ada language, running the latest Ada version 2012. Getting started with the OneCompiler's Ada editor is easy and fast. The editor shows sample boilerplate code when you choose language as Ada. OneCompiler also has reference programs, where you can look for the sample code and start learning. Happy learning!!

Read inputs from stdin

OneCompiler's Ada online editor supports stdin and users can give inputs to programs using the STDIN textbox under the I/O tab. Following is a sample Ada program which takes name as input and prints hello message with your name.

with Ada.Text_IO; use Ada.Text_IO;
procedure Hello is
begin
  declare
  name : String := Ada.Text_IO.Get_Line;
  begin
  Ada.Text_IO.Put ("Hello ");
  Ada.Text_IO.Put_Line (name);
	end;
end Hello;

About Ada

Ada is suitable for all development needs and it is extremely good for developing very large applications with built-in features which supports structured, object-oriented, generic, distributed and concurrent programming directly. Ada was designed by Jean Ichbiah.

It's a Good choice for Rapid Application Development, Extreme Programming. It is a very strong and statically typed language.

Syntax help

Loops

1. Infinite loop:

This is the simplest loop

begin
   Index := 1; --initialization
    loop                            
     --code
	exit when Index = n;
	end loop;

2. while loop

While is also used to iterate a set of statements based on a condition. Usually while is preferred when number of iterations are not known in advance.

   Count := 1;    --initialization
   while Count < n loop  
   --code
   end loop;

3. for loop

For loop is used to iterate a set of statements based on a condition. Usually for loop is preferred when number of iterations are known in advance.

for Index in 1..n loop          
--code
end loop;

Sub programs

Ada distinguishes functions and procedures. In simpler terms, functions return some value and must be called as part of larger expressions. Procedures never return a value.

Functions and procedures are collectively called as sub-programs.

Syntax for procedure

procedure proc-name
(X : in Integer ; Y : out Integer ; Z : in out Integer ) is
begin
X := 10; −− it's an Error as you can’t modify an in parameter.
Y := X; −− can modify Y as it's an out parameter.
Z := Z + 1; −− can read and write as it's an in out parameter.
end proc-name;

Syntax for functions

function function_name(declaration) return value is
begin
--code
end function-name;

Help us with your feedback!

Reference Programs:

Ada

No tags available for Ada

How to use?

Choose the language in which you want to run your program, by clicking the button next to Run. And then write your code in the code box, You can use the auto complete snippets and warnings and errors which helps you to write better code faster way.
Once you are done writing your code click the Run button, now the code will be submitted to OneCompiler and you will see the results in a second.

How to contribute?

Please fork OneCompiler repository and contribute us by adding more languages or the features to the existing OneCompiler backend.
You can also contibute to the community by adding more programs which users can search and use as base code for their programs.

API & More

You can embed OneCompiler into your own website. That helps your website users to write and test their programs within your website.
If you want to run and see the results from your backend you can utilize the OneCompiler API by integrating it with your backend.