// The underscore before a variable name is a naming convention
// _val, is used when defining
// the private member variable for a public property.
// Example usage:
private string _val;
public string Values
{
get { return _val;}
set {_val = value;}
}
"""Use of _ as a variable
It is to indicate throwaway variables,
...i.e. variables that are not reused anywhere else (as they are...
...not logically important) but for syntax reasons you have to put
This saves space for variables that are actually reused...
...and provides a good mental model for essential and unessential parts...
...of your code
Of course, take this as a guideline.
There are instances where naming those variables are better for readability...
...especially in group projects
Check out the source for more info!
"""
lst1 = [_ for _ in range(10)]
print(lst1)
# [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]