8000 Explained how to improve the readability of long numeric literals · symfony/symfony-docs@494a9ae · GitHub
[go: up one dir, main page]

Skip to content

Commit 494a9ae

Browse files
javiereguiluzxabbuh
authored andcommitted
Explained how to improve the readability of long numeric literals
1 parent 7a8e74a commit 494a9ae

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

components/yaml.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,25 @@ changed using the third argument as follows::
203203
foo: bar
204204
bar: baz
205205
206+
Numeric Literals
207+
................
208+
209+
Long numeric literals, being integer, float or hexadecimal, are known for their
210+
poor readability in code and configuration files. That's why YAML files allow to
211+
add underscores to improve their readability:
212+
213+
.. code-block:: yaml
214+
215+
parameters:
216+
credit_card_number: 1234_5678_9012_3456
217+
long_number: 10_000_000_000
218+
pi: 3.14159_26535_89793
219+
hex_words: 0x_CAFE_F00D
220+
221+
During the parsing of the YAML contents, all the ``_`` characters are removed
222+
from the numeric literal contents, so there is not a limit in the number of
223+
underscores you can include or the way you group contents.
224+
206225
Advanced Usage: Flags
207226
---------------------
208227

0 commit comments

Comments
 (0)
0