variables - "var_name" VS "var-name" VS "varName" - Which is supported by the widest variety of languages -


i have seen multi-word variables displayed in 3 ways:

  • with underscore - var_name
  • with hyphen - var-name
  • with capitalization - varname

different languages support different ways. example, can use - (hyphens) in css classnames / ids, not in javascript variable names

my ultimate question is:

which supported across different programming languages, , there advantages or limitations of each?

i think tie between underscore '_' , camel case - or capitalization call it. hyphen gets interpreted operator in many languages, should avoided common naming tool.

all languages have used (fortran, pascal, c/c++, java, php, js, python) differentiate , accept capitalization , underscores in variable names. so, becomes matter of preference. taught camelcase through school have stuck with. creates bit shorter variable name inserting underscores , easier type. having said that, think names underscores bit more readable, , reason enough use them on others. if brain change it's habits, use underscores.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -