Comparison of Features Used in Programs

758 Words2 Pages

Comparison of Features Used in Programs

In Visual Basic variables are declared using Dim and then the name of

the variable, which could be anything of your choice. Dim is short for

DIMENSION. A Dim statement tells the computer to set up a place in the

memory with the right dimensions to store a piece of data that has a

certain data type. For example:

Dim k As Integer

Dim k As Integer sets up a place (location in memory) with the name k

and enough space to hold a whole number. “k” is a variable because the

values that this location have can vary. As well as setting up the

right size of space for a variable, a Dim statement sets up all the

things that can be done with the variable according to its data type.

In this case Dim statement sets up all the things that can be done

with a whole numbers.

In Pascal the variables are declared using VAR instead of using Dim.

The following is an example in Pascal of how a variable is declared:

VAR RANKS:ARRAY [0..51] OF INTEGER;

SUITS:ARRAY [0..51] OF CHAR;

I:INTEGER;

In JavaScript the Variable are also declared in a similar way to

Pascal for example:

Var day=mydate.getDay();

This is the declaring of the variables, you can also assign values to

the variables.

Data Types: is a formal description of the kind of data being stored

or manipulated within a program or system, for example alphabetic

data, numeric data or logical data some of the more important one are

listed below.

=====================================================================

Number (integer): is any whole number, whether positive or negative.

In visual basic you can declare the number as an integer, for example:

Dim bookingNo As Integer

and this is the same in Pascal, for example

VAR I, J: INTEGER;

Number (real): is any number represented with a fractional part. In

most high-level languages, real indicates that floating-point

representation is to be used when the number is stored or manipulated.

More about Comparison of Features Used in Programs

Open Document