Integer built-in type. Signed 64-bit integer type. It can take values in the interval [code][-2^63, 2^63 - 1][/code], i.e. [code][-9223372036854775808, 9223372036854775807][/code]. Exceeding those bounds will wrap around. [int] is a [Variant] type, and will thus be used when assigning an integer value to a [Variant]. It can also be enforced with the [code]: int[/code] type hint. [codeblocks] [gdscript] var my_variant = 0 # int, value 0. my_variant += 4.2 # float, value 4.2. var my_int: int = 1 # int, value 1. my_int = 4.2 # int, value 4, the right value is implicitly cast to int. my_int = int("6.7") # int, value 6, the String is explicitly cast with int. var max_int = 9223372036854775807 print(max_int) # 9223372036854775807, OK. max_int += 1 print(max_int) # -9223372036854775808, we overflowed and wrapped around. [/gdscript] [csharp] int myInt = (int)"6.7".ToFloat(); // int, value 6, the String is explicitly cast with int. // We have to use `long` here, because GDSript's `int` // is 64 bits long while C#'s `int` is only 32 bits. long maxInt = 9223372036854775807; GD.Print(maxInt); // 9223372036854775807, OK. maxInt++; GD.Print(maxInt); // -9223372036854775808, we overflowed and wrapped around. // Alternatively, if we used C#'s 32-bit `int` type, the maximum value is much smaller: int halfInt = 2147483647; GD.Print(halfInt); // 2147483647, OK. halfInt++; GD.Print(halfInt); // -2147483648, we overflowed and wrapped around. [/csharp] [/codeblocks] Constructs a default-initialized [int] set to [code]0[/code]. Constructs an [int] as a copy of the given [int]. Cast a [bool] value to an integer value, [code]int(true)[/code] will be equals to 1 and [code]int(false)[/code] will be equals to 0. Cast a float value to an integer value, this method simply removes the number fractions (i.e. rounds [code]from[/code] towards zero), so for example [code]int(2.7)[/code] will be equals to 2, [code]int(0.1)[/code] will be equals to 0 and [code]int(-2.7)[/code] will be equals to -2. This operation is also called truncation. Returns [code]true[/code] if operands are different from each other. Returns [code]true[/code] if operands are different from each other. Returns the result of the modulo operator for two integers, i.e. the remainder after dividing both numbers. [codeblock] print(5 % 2) # 1 print(12 % 4) # 0 print(12 % 2) # 2 [/codeblock] Returns the result of bitwise [code]AND[/code] operation for two integers. [codeblock] print(3 & 1) # 1 print(11 & 3) # 3 [/codeblock] It's useful to retrieve binary flags from a variable. [codeblock] var flags = 5 # Do something if the first bit is enabled. if flags & 1: do_stuff() [/codeblock] Multiplies an [int] and a [float]. The result is a [float]. Multiplies two [int]s. Multiplies each component of the vector by the given integer. [codeblock] print(2 * Vector2(1, 1)) # Vector2(2, 2) [/codeblock] Multiplies each component of the integer vector by the given integer. Multiplies each component of the vector by the given integer. Multiplies each component of the integer vector by the given integer. Multiplies each component of the quaternion by the given integer. Multiplies each component of the color by the given integer. [codeblock] print(2 * Color(0.5, 0.5, 0.5)) # Color(1, 1, 1) [/codeblock] Unary plus operator. Doesn't have any effect. [codeblock] var a = +1 # a is 1. [/codeblock] Adds an [int] to a [float]. The result is a [float]. Adds two integers. Unary minus operator. Negates the number. [codeblock] var a = -1 # a is -1. print(-a) # 1 [/codeblock] Subtracts a [float] from an [int]. The result is a [float]. Subtracts two integers. Divides an [int] by a [float]. The result is a [float]. [codeblock] print(10 / 3.0) # 3.333... [/codeblock] Divides two integers. The decimal part of the result is discarded (truncated). [codeblock] print(10 / 2) # 5 print(10 / 3) # 3 [/codeblock] Returns [code]true[/code] if this [int] is less than the given [float]. Returns [code]true[/code] the left integer is less than the right one. Performs bitwise shift left operation on the integer. Effectively the same as multiplying by a power of 2. [codeblock] print(10 << 1) # 20 print(10 << 4) # 160 [/codeblock] Returns [code]true[/code] if this [int] is less than or equal to the given [float]. Returns [code]true[/code] the left integer is less than or equal to the right one. Returns [code]true[/code] if the integer is equal to the given [float]. Returns [code]true[/code] if both integers are equal. Returns [code]true[/code] if this [int] is greater than the given [float]. Returns [code]true[/code] the left integer is greater than the right one. Returns [code]true[/code] if this [int] is greater than or equal to the given [float]. Returns [code]true[/code] the left integer is greater than or equal to the right one. Performs bitwise shift right operation on the integer. Effectively the same as dividing by a power of 2. [codeblock] print(10 >> 1) # 5 print(10 >> 2) # 2 [/codeblock] Returns the result of bitwise [code]XOR[/code] operation for two integers. [codeblock] print(5 ^ 1) # 4 print(4 ^ 7) # 3 [/codeblock] Returns the result of bitwise [code]OR[/code] operation for two integers. [codeblock] print(2 | 4) # 6 print(1 | 3) # 3 [/codeblock] It's useful to store binary flags in a variable. [codeblock] var flags = 0 # Turn first and third bit on. flags |= 1 flags |= 4 [/codeblock] Returns the result of bitwise [code]NOT[/code] operation for the integer. It's effectively equal to [code]-int + 1[/code]. [codeblock] print(~4) # -3 print(~7) # -6 [/codeblock]