+ 18

Why only underscore (_) is being used in variable name in programming languages ?

Why only underscore has special place in programming languages why other symbol hasn't have ??🤔

17th Jul 2019, 5:16 AM
Prince Raj
Prince Raj - avatar
21 odpowiedzi
+ 15
It doesn't mean anything. It is rather a common naming convention for private member variables to keep them separated from methods and public properties. 
17th Jul 2019, 5:37 AM
Ananya Seghal
Ananya Seghal - avatar
+ 11
But double underscore(__) is reserved in some programming languages what about that?😒
18th Jul 2019, 7:28 PM
Prince Raj
Prince Raj - avatar
+ 8
It's not a big issue but I think it's similarity to empty spaces makes it special.
19th Jul 2019, 2:12 PM
Manoj
Manoj - avatar
+ 8
what will you have do?? to know😂
20th Jul 2019, 6:37 PM
Prince Raj
Prince Raj - avatar
+ 7
Other symbols like + or * maynbe confused with operators.
18th Jul 2019, 4:00 AM
Sonic
Sonic - avatar
+ 5
You are free to use anything as variable name.. lets test other possibilities: Justtryusingnone Or#try#using#other#signs Maybe!this!looks!better I_guess_I_will_be_using_underscores_again
17th Jul 2019, 9:34 AM
daria
daria - avatar
+ 5
There are 3 naming schemes that are commonly used: CamelCase in most object oriented languages snake_case in cool languages like C and Python kebap-case in the superior LISP
18th Jul 2019, 11:04 AM
Loeschzwerg
+ 4
Because all programming languages ignoring SPACE so... better understanding of variables names the underscores are useful
17th Jul 2019, 12:55 PM
MADHU KUMAR KOULAS
MADHU KUMAR KOULAS - avatar
+ 4
No specific reason only identification of variables becomes easy 🤔
18th Jul 2019, 1:54 AM
Sanjay Kamath
Sanjay Kamath - avatar
+ 4
Because underscore is not a reserve word we cannot use reserve words as a variable name subtraction sign(-) is reserved for subtraction that is why we cannot use it as a variable name sometimes we use underscore to make our variable in more human readable form ....like choiceinput to choice_input it is easy to read
18th Jul 2019, 8:51 AM
Muhammad Mehran Bin Azam
Muhammad Mehran Bin Azam - avatar
+ 4
Because space is counted as a character in c++ but _ (underscore) or any other symbol are allowed in programming. There are some exceptions in special symbols also..as they have special meaning called keywords
18th Jul 2019, 3:11 PM
Nikhil
Nikhil - avatar
+ 3
Doesn't Python use "camelspace" e.g. MyVariableName instead of My_Variable_Name?
17th Jul 2019, 3:46 PM
Charles
+ 3
The compiler in some languages will confuse a "-" as a minus operator.
19th Jul 2019, 4:44 AM
Robert Arnold
Robert Arnold - avatar
+ 3
To increase readability....🙂
16th Aug 2019, 5:20 AM
Suraj Shrivastava
Suraj Shrivastava - avatar
+ 2
Anything except whitespaces and numbers first like 1time onetime*
17th Jul 2019, 11:58 AM
Peter Andersson
Peter Andersson - avatar
+ 2
In most languages, an underscore can be used as part of an identifier (variable name, function name, class name etc) as generally spaces are not a valid part of an identifier.
19th Jul 2019, 3:20 AM
Aishatu hamidu saidu
Aishatu hamidu saidu - avatar
+ 1
Hi, What are you working on?
19th Jul 2019, 9:30 AM
Евгений Коробейников
Евгений Коробейников - avatar