Integer: Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>JulienDethurens
Considering it is not agreed universally what exactly whole numbers, natural numbers, and all the rest are, let's just say it in simpler terms.
>Legend26
No edit summary
Line 3: Line 3:
{{CatUp|Data Types}}
{{CatUp|Data Types}}


An integer is classified as any positive or negative number, including zero.
An integer is classified as any positive or negative whole number (a number with no decimal component), including zero.
{{Example|These are all Integers
{{Example|These are all Integers
5,
5,
Line 13: Line 13:


{{Example|These are '''NOT''' Integers
{{Example|These are '''NOT''' Integers
5.3 (No decimal places in Integers),
5.3,
636.24
636.24
}}
}}


Integers can be used where you need to have negative numbers, but not a lot of decimal accuracy. Your numbers can't get very accurate (there is no "between" 1 and 2) but they can go negative.
Integers are used when you need a number with no decimal place or it doesn't make sense to have a decimal. Because integers are whole numbers, there are no integers "between" 1 and 2.


In [[RBX.lua.IntValue (Object)|IntValues]], the lowest value it can hold is -2<sup>31</sup> or -2,147,483,648.  The highest value it can hold is 2<sup>31</sup>-1, or 2,147,483,647.  For the computer geeks out there, this is a 32-bit (or long) signed integer value.
In [[RBX.lua.IntValue (Object)|IntValues]], the lowest value it can hold is -2<sup>31</sup> or -2,147,483,648.  The highest value it can hold is 2<sup>31</sup>-1, or 2,147,483,647.  For the computer geeks out there, this is a 32-bit (or long) signed integer value.


In Lua scripts, the variables that are just numbers are actually double precision floating point (or just 'double') numbers. For more information about this data type, look at the [[Number | Number data type page]].
In Lua scripts, there are no specific integer numbers. The number variables are actually double precision floating point (or just 'double') numbers. For more information about this data type, look at the [[number]] data type page.


[[Category:Data Types]]
[[Category:Data Types]]

Revision as of 02:43, 9 March 2012

An integer is classified as any positive or negative whole number (a number with no decimal component), including zero.

Example
These are all Integers

5, 45213, 753, -4256, -842,


Example
These are NOT Integers

5.3, 636.24


Integers are used when you need a number with no decimal place or it doesn't make sense to have a decimal. Because integers are whole numbers, there are no integers "between" 1 and 2.

In IntValues, the lowest value it can hold is -231 or -2,147,483,648. The highest value it can hold is 231-1, or 2,147,483,647. For the computer geeks out there, this is a 32-bit (or long) signed integer value.

In Lua scripts, there are no specific integer numbers. The number variables are actually double precision floating point (or just 'double') numbers. For more information about this data type, look at the number data type page.