mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-05 22:09:56 +03:00
Merge pull request #3908 from Calinou/gdscript-basics-underscore-literals
Document support for underscores in number literals in GDScript basics
This commit is contained in:
@@ -284,7 +284,7 @@ Literals
|
|||||||
+--------------------------+----------------------------------------+
|
+--------------------------+----------------------------------------+
|
||||||
| ``45`` | Base 10 integer |
|
| ``45`` | Base 10 integer |
|
||||||
+--------------------------+----------------------------------------+
|
+--------------------------+----------------------------------------+
|
||||||
| ``0x8F51`` | Base 16 (hexadecimal) integer |
|
| ``0x8f51`` | Base 16 (hexadecimal) integer |
|
||||||
+--------------------------+----------------------------------------+
|
+--------------------------+----------------------------------------+
|
||||||
| ``0b101010`` | Base 2 (binary) integer |
|
| ``0b101010`` | Base 2 (binary) integer |
|
||||||
+--------------------------+----------------------------------------+
|
+--------------------------+----------------------------------------+
|
||||||
@@ -299,6 +299,14 @@ Literals
|
|||||||
| ``$NodePath`` | Shorthand for ``get_node("NodePath")`` |
|
| ``$NodePath`` | Shorthand for ``get_node("NodePath")`` |
|
||||||
+--------------------------+----------------------------------------+
|
+--------------------------+----------------------------------------+
|
||||||
|
|
||||||
|
Integers and floats can have their numbers separated with ``_`` to make them more readable.
|
||||||
|
The following ways to write numbers are all valid::
|
||||||
|
|
||||||
|
12_345_678 # Equal to 12345678.
|
||||||
|
3.141_592_7 # Equal to 3.1415927.
|
||||||
|
0x8080_0000_ffff # Equal to 0x80800000ffff.
|
||||||
|
0b11_00_11_00 # Equal to 0b11001100.
|
||||||
|
|
||||||
Comments
|
Comments
|
||||||
~~~~~~~~
|
~~~~~~~~
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user