x


what the hell is a int? (or a float, or boolean, or string!)

hello, everyone.

I have heard int before but i dont know what it is and what it is used for. Can you guys possebly cast som light upon this, please? Thanks!

more ▼

asked Nov 17, 2010 at 04:25 PM

OrangeLightning gravatar image

OrangeLightning
6.6k 126 112 169

Go ask generic-programming questions at stackoverflow.com

Dec 07, 2010 at 02:01 AM fireDude67

So fireDude67 I assume that you edited this post, right? But how is this not Unity related?

Jan 23, 2011 at 06:55 PM OrangeLightning
(comments are locked)
10|3000 characters needed characters left

3 answers: sort voted first

In Unity's Javascript and C#, int is a type. It is short for "integer", which means whole numbers. You use int to specify that you want your variable to contain only whole numbers.

For example, 3 is an integer. 3.25 is not an integer.

When programming, your variables generally have a specific type, and you should select the appropriate type according to what you want to use the variable for. Four of the most common types are:

  • int : An integer (eg, 3).
    Can be a whole number between -2147483648 and 2147483647

  • float : A fractional (floating point) number (eg, 3.25907).
    Can be a number between roughly 1.5 x 10^45 to 3.4 10^38, in floating point format.

  • String : A sequence of characters (eg, "Hello User 6555")
    (no specified maximum length, as far as I'm aware!)

  • boolean : A true/false value.
    Can only contain either the value true or false.

There are many more types that you can use for variables, including other numeric types for more specific situations, and other more complex types such as structs and classes which you will need to learn about in order to make progress using Unity.

Good luck :)

more ▼

answered Nov 17, 2010 at 04:48 PM

duck gravatar image

duck ♦♦
47.5k 129 189 457

(comments are locked)
10|3000 characters needed characters left

int just mean integer, which means number

Eg:

var Number : int = 4;

just means that the Number var only holds a number variable.

A variable can hold anything. Int just means that the variable is only limited to numbers

more ▼

answered Nov 17, 2010 at 04:28 PM

oliver-jones gravatar image

oliver-jones
3.9k 708 1183 688

just to add on, the integer is the same one we learn in our math classes. Integers are essentially whole numbers.

Nov 17, 2010 at 04:30 PM denewbie
(comments are locked)
10|3000 characters needed characters left

I thought you are referring to "int?".

just in case it means nullable int.

it refers to int that can be stored with a null.

more ▼

answered Jul 10 at 05:19 PM

vfxjex gravatar image

vfxjex
26 2

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x659
x414
x338
x201
x30

asked: Nov 17, 2010 at 04:25 PM

Seen: 13158 times

Last Updated: Jul 10 at 05:19 PM