Manipulate position on Input

I know this looks damn silly. I’m new to Unity3D and programming. So, please help.

I need my player to move 1 unit right/left based on the Keyboard arrow I pressed.
Following script throws error saying “Cannot modify a value type return value of …”
And, some times it throws an error but, no error shows up. I think I’m doing something terribly wrong.

if(Input.GetButtonDown(“Horizontal”))
{
transform.position.x += 1;
}

In C# you can not change field of Vector3 structure, but you can change whole structure:

if(Input.GetButtonDown("Horizontal"))
{
   transform.position = new Vector3(transform.position.x+1, transform.position.y, transform.position.z);
}

Or you can use Translate() method for move forward relative to character:

if(Input.GetButtonDown("Horizontal"))
{
   transform.Translate(Vector3.forward * Time.deltaTime);
}

Thanks a lot for the clarity. It helped me a lot!