I’m trying to convert an existing C function to Erlang but am having a bit of trouble understanding how it’s going to work. Let’s say I have the following function in C:
void(int *x,int *y,int z,int a)
{
if(z<a)
{
*x = z + a;
*y = z - a;
}
}
How would I write something like that in Erlang as a function module? I understand that normally you write your function and it would return an operation. But what if I have to do calculations on multiple variables?
you may return a tuple like: {X, Y}
Here is a function that doubles two values given as input:
In the shell: