Allow underscores _
as digit separates in float and integer literals.
#3983
Labels
proposal
This issue suggests modifications. If it also has the "accepted" label then it is planned.
Overview
Allow the use of underscore
_
in float and integer literals as a visual separator to enhance readability of long number literals. For example:This is a common feature of several other languages and can make code much easier to read.
Modifications to grammar.
Underscores could be freely used inside number literals except:
_
can't be the first or last character of a number literal_
can't appear next to.-+ep
in float literals.So the grammar for integer and float literals would become:
Examples of valid literals
Examples of invalid literals
The text was updated successfully, but these errors were encountered: