Ada Programming/Statements - eMyTextBooks

Search:  

Free online books - just read it!

See live article   •   Ada Programming/Statements
 

Ada Programming/Statements


This Computer programming article is available in pseudocode, Ada, C, C++ and Python.

Table of contents

Note: there are some simplifications in the explanations below. Don't take anything too literally.

Most programming languages have the concept of a statement. A statement is a command that the programmer gives to the computer. For example:

Ada.Text_IO.Put_Line ("Hi there!");

This command has a verb ("Put_Line") and other details (what to print). In this case, the command "Put_Line" means "show on the screen," not "print on the printer." The programmer either gives the statement directly to the computer (by typing it while running a special program), or creates a text file with the command in it. You could create a file called "hi.txt", put the above command in it, and give the file to the computer.

If you have more than one command in the file, each will be performed in order, top to bottom. So the file could contain:

Ada.Text_IO.Put_Line ("Hi there!");
Ada.Text_IO.Put_Line ("Strange things are afoot...");

This does seem like a lot of typing but don't worry: Ada allows you to declare shorter aliasnames if you need a long statement very often.

The computer will perform each of these commands sequentially. It's invaluable to be able to "play computer" when programming. Ask yourself, "If I were the computer, what would I do with these statements?" If you're not sure what the answer is, then you are very likely to write incorrect code. Stop and check the manual for the programming language you're using.

In the above case, the computer will look at the first statement, determine that it's a Put_Line statement, look at what needs to be printed, and display that text on the computer screen. It'll look like this:

Hi there!

Note that the quotation marks aren't there. Their purpose in the program is to tell the computer where the text begins and ends, just like in English prose. The computer will then continue to the next statement, perform its command, and the screen will look like this:

Hi there!
Strange things are afoot...

When the computer gets to the end of the text file, it stops. There are many different kinds of statements, depending on which programming language is being used. For example, there could be a beep statement that causes the computer to output a beep on its speaker, or a window statement that causes a new window to pop up.

Also, the way statements are written will vary depending on the programming language. These differences are fairly superficial. The set of rules like the first two is called a programming language's syntax. The set of verbs is called its library.

This article is available in wikibook pseudocode, Ada, C, C++ and Python - do have a look at the other languages as well.


Also helps finding: AdaProgrammingStatements, AdaProgramming, ProgrammingStatements, sda, programing, statments, adu, programmin, staements, adas, progamming, satements, adz, prgramming, statemnts

   
 
  
Add to bookmarks
Related Articles
 
Ada Programming/Keywords/null
Computer programming/Statements:3
Programming:Python:Statements
Programming:C:Statements
Computer programming/Statements:0
Computer programming/Statements
Ada Programming
Computer programming
Top Articles
 
Ada Programming/Keywords/array
Ada Programming/Keywords/begin
Ada Programming/Keywords/in
Ada Programming/Keywords/null
Ada Programming/Keywords/package
Ada Programming/Keywords/record
Ada Programming/Keywords/renames
Cookbook:Flour
Cookbook:Fruit
Cookbook:Sugar
Japanese
Programming:C
SA NCS
SA NCS:Accounting
SA NCS:Design
SA NCS:Dramatic Arts
SA NCS:Life Orientation
SA NCS:Second Additional Language
South African Curriculum
The Golden Bough
Wikibooks Pokédex:National Index
Search LiveJournal blogs for Ada Programming/Statements
 

Watch Anime Online  •  Internet Advertising  •  Wordpress Themes  •  Credit Consolidation •  Kamala

Copyright @ 2005 eMyTextBooks.com
This article is from Wikibooks. All text is available under the terms of the GNU Free Documentation License.