DEV Community

Adam La Rosa
Adam La Rosa

Posted on

Subtle Differences

In the United States people say "hello", in France people might say "bonjour". Programming languages seem to have the same nuance. Just as different languages might have the same way of saying "hello", programming
languages have different ways of achieving the same results.

For example, in Ruby to declare an array one can easily give the instruction

name_of_my_array = []

In C++ things are a little different. C++ has an array, but the size must be declared at the time of declaration, as well as the variable type. So if you wanted to create an array with five locations of integers, it would be done like so:

int name_of_my_array [5];

The same little differences can be found in Ruby and R. In Ruby, as with many popular languages, assignment is done with an equals sign.

name_of_my_variable = "string"

Where as in R, assignment can be done with an arrow.

name of my variable <- "string"

With learning new languages there's a sense of security in the knowledge that while you may have to learn new ways of doing something, the things you do always seem the same.

Top comments (0)