1. Computing & Technology

Discuss in my forum

Imperative Language

By , About.com Guide

Definition:

An imperative language uses a sequence of statements to determine how to reach a certain goal. These statements are said to change the state of the program as each one is executed in turn.

Examples:

Java is an imperative language. For example, a program can be created to add a series of numbers:

 int total = 0;
 int number1 = 5;
 int number2 = 10;
 int number3 = 15;
 total = number1 + number2 + number3; 

Each statement changes the state of the program, from assigning values to each variable to the final addition of those values. Using a sequence of five statements the program is explicitly told how to add the numbers 5, 10 and 15 together.

Glossary:

# A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

©2012 About.com. All rights reserved.

A part of The New York Times Company.