Question about functions

Can someone tell me why such a function does not work in unity ?

This function does not change my variable. Although the parameter is ultimately set by my variable speed? I would like to build functions that allow such changes without directly addressing the actual variable. I thought the parameter that acts as a placeholder should make this possible. It can’t be that I have to build a return int function and then assign it to my variable again to enable a change?

int speed = 3;

public void MoveObject(int newSpeed)
{
    newSpeed += 10f;
}

void Update()
{
    if (Input.GetKeyDown(KeyCode.Space))
    {
        MoveObject(speed);
    }
}

You are passing the variable value. To pass a variable reference to the method, so that it can be modified, use ref keyword, like this:

public void MoveObject(ref int newSpeed)
{
    newSpeed += 10f;
}

void Update()
{
    if (Input.GetKeyDown(KeyCode.Space))
    {
        MoveObject(ref speed);
    }
}