8000 feature #7196 Explained how to improve the readability of long numeri… · symfony/symfony-docs@03d7e4f · GitHub
[go: up one dir, main page]

Skip to content

Commit 03d7e4f

Browse files
committed
feature #7196 Explained how to improve the readability of long numeric literals (javiereguiluz)
This PR was squashed before being merged into the 3.2 branch (closes #7196). Discussion ---------- Explained how to improve the readability of long numeric literals This fixes #7183. Commits ------- 494a9ae Explained how to improve the readability of long numeric literals
2 parents 2e23084 + 494a9ae commit 03d7e4f

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
< 8000 div data-testid="addition diffstat" class="DiffSquares-module__diffSquare--h5kjy DiffSquares-module__addition--jeNtt">
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
< 75C6 /code>
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