# Integer

Updated: 04/26/2017 by Computer Hope

An **integer** is a numeric value, for example, 1 and 1234 are examples of integers. A **negative integer** is any negative numeric value, for example, -1 and -1234 are examples of a negative integers. In most programming languages, you can convert a number into an integer using the **int** function. Below is an example of how this could be done in Perl.

my $random = int(rand(10));

print "Random number between 0 and 10: $random\n";

In the above example, the $random variable is assigned a random number, which is converted into a whole number using the int() function. If the number was not converted to a whole number your random number would likely be a decimal number.

Data type, Number, Numeric, Programming terms, String, Whole number