Difference between revisions of "Integer"

From Second Life Wiki
Jump to navigation Jump to search
m (debug channel)
(Minor rephrasing of the sentences and a few examples.)
Line 1: Line 1:
{{LSL Header}}
{{LSL Header}}
[[Category: LSL Types]]
[[Category: LSL Types]]
Integer data types are signed 32 bit values. Integers are whole numbers. If you want a decimal point, see {{LSLG|float}}


The range is: −2,147,483,648 to +2,147,483,647
=Integers=
An  integer data types are signed 32 bit values between −2,147,483,648 and +2,147,483,647 (that is 0x00000000 to 0xFFFFFFFF in hex). Integers are whole numbers. If you want a decimal point, see {{LSLG|float}}.


You can use DEBUG_CHANNEL as a constant for max int.
You can use DEBUG_CHANNEL as a constant for the maximum integer.
 
==Examples==
All of the following are integers:
<pre>
integer firstInt = 5512623;
integer secondInt = ACTIVE;
integer thridInt = 0x61EC1A;
integer fourthInt = -160693;
</pre>
 
The following are NOT integers, see {{LSLG|float}} for them:
<pre>
integer firstInt = 125.2; //Integers can't have a decimal.
integer secondInt = 10000000000; //Integers can't be larger than 2,147,483,647.
</pre>

Revision as of 18:07, 26 November 2007

Integers

An integer data types are signed 32 bit values between −2,147,483,648 and +2,147,483,647 (that is 0x00000000 to 0xFFFFFFFF in hex). Integers are whole numbers. If you want a decimal point, see float.

You can use DEBUG_CHANNEL as a constant for the maximum integer.

Examples

All of the following are integers:

integer firstInt = 5512623;
integer secondInt = ACTIVE;
integer thridInt = 0x61EC1A;
integer fourthInt = -160693;

The following are NOT integers, see float for them:

integer firstInt = 125.2; //Integers can't have a decimal.
integer secondInt = 10000000000; //Integers can't be larger than 2,147,483,647.