Why underscore before variable name
Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Does ES6 make JavaScript frameworks obsolete? Podcast Do polyglots have an edge when it comes to mastering programming Featured on Meta. Now live: A fully responsive profile. Related 4. Hot Network Questions. Question feed. Ethereum Stack Exchange works best with JavaScript enabled. When the conditional part of an if -statement is long enough to require that it be written across multiple lines, it's worth noting that the combination of a two character keyword i.
This can produce a visual conflict with the indented suite of code nested inside the if -statement, which would also naturally be indented to 4 spaces. This PEP takes no explicit position on how or whether to further visually distinguish such conditional lines from the nested suite inside the if -statement.
Acceptable options in this situation include, but are not limited to:. Starting variable name with underscore python Asked ago. Active 3 hr before. Viewed times. Correct: Aligned with opening delimiter.
Wrong: Arguments on first line forbidden when not using vertical alignment. No extra indentation. A leading underscore indicates to other programmers that the attribute or method is private. Learn more. Asked 7 years, 11 months ago. Active 1 year, 4 months ago. Viewed 56k times. Improve this question. Well, usually we don't. But not in Java. AmanArora - that i also know, I want reason. I am beginner so I am asking, I am not expecting this answer.
To distinguish between Static variables and instance variables,maybe! As Maroun mentioned its to distinguish between these 2 variables. At my university I actually learned to do it like that in C , but never saw it in Java Show 3 more comments.
Active Oldest Votes. Improve this answer. Wasiq 2 2 silver badges 11 11 bronze badges.
0コメント