Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 865879f

Browse files
committedSep 2, 2023
Merge pull request #81227 from raulsntos/docs/int
Fix int's C# documentation
2 parents f383249 + 0897a79 commit 865879f

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed
 

‎doc/classes/int.xml

+11-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
[/gdscript]
1818
[csharp]
1919
int x = 1; // x is 1
20-
x = 4.2; // x is 4, because 4.2 gets truncated
20+
x = (int)4.2; // x is 4, because 4.2 gets truncated
2121
// We use long below, because GDScript's int is 64-bit while C#'s int is 32-bit.
2222
long maxLong = 9223372036854775807; // Biggest value a long can store
2323
maxLong++; // maxLong is now -9223372036854775808, because it wrapped around.
@@ -27,12 +27,19 @@
2727
maxInt++; // maxInt is now -2147483648, because it wrapped around
2828
[/csharp]
2929
[/codeblocks]
30-
In GDScript, you can use the [code]0b[/code] literal for binary representation, the [code]0x[/code] literal for hexadecimal representation, and the [code]_[/code] symbol to separate long numbers and improve readability.
31-
[codeblock]
30+
You can use the [code]0b[/code] literal for binary representation, the [code]0x[/code] literal for hexadecimal representation, and the [code]_[/code] symbol to separate long numbers and improve readability.
31+
[codeblocks]
32+
[gdscript]
3233
var x = 0b1001 # x is 9
3334
var y = 0xF5 # y is 245
3435
var z = 10_000_000 # z is 10000000
35-
[/codeblock]
36+
[/gdscript]
37+
[csharp]
38+
int x = 0b1001; // x is 9
39+
int y = 0xF5; // y is 245
40+
int z = 10_000_000; // z is 10000000
41+
[/csharp]
42+
[/codeblocks]
3643
</description>
3744
<tutorials>
3845
</tutorials>

0 commit comments

Comments
 (0)
Please sign in to comment.