Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why are the variables in Erlang designed to begin with capital letter?

Tags:

erlang

I'm new to Erlang and just wonder why the variables are designed to begin with capital letter which is so different from that in other languages?

Perhaps because that is immutable?

like image 453
Tony Han Avatar asked Feb 04 '15 14:02

Tony Han


2 Answers

Early versions of Erlang were implemented in Prolog, and just like Prolog, Erlang variables start with either an uppercase letter or an underscore.

like image 62
Steve Vinoski Avatar answered Sep 22 '22 02:09

Steve Vinoski


In addition to what @SteveVinoski said,

Starting with a capital letter separates variables from atoms, which are used frequently in Erlang code. Atoms always start with a lowercase letter. Both module and function names are atoms.

like image 20
Stratus3D Avatar answered Sep 26 '22 02:09

Stratus3D