Why does same script work in JavaScript and Boo, but not in C#?

I’m doing some beginner tutorials, and I tried writing the same script in all 3 languages. However, it doesn’t work in C#.

I get the following error in C#:
Assets/Bob.cs(14,35): error CS1612: Cannot modify a value type return value of `UnityEngine.Transform.position’. Consider storing the value in a temporary variable

Here are my scripts:

C#:
using UnityEngine;
using System.Collections;

public class Bob : MonoBehaviour {

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
		if (Input.GetButtonDown("Jump")){
			transform.position.z += 1.0f;
		}
	}
}

JS:

function Update () {
	if (Input.GetButtonDown("Jump")){
		transform.position.z += 1.0;
	}
}

Boo:

class Bob3 (MonoBehaviour): 

	def Start ():
		pass
	
	def Update ():
		if Input.GetButtonDown("Jump"):
			transform.position.z += 1.0

I understand what the error means - transform.position returns a value rather than a reference, and that can’t be modified. However, why does it work in one language and not the other? Is there a Set method or property in the C# version that I’m missing?

You need to work with the entirety of the position rather than one of its sub components. So, to do what you have in your example you would do:

public class Bob : MonoBehaviour {

    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update () {
       if (Input.GetButtonDown("Jump")){
         Vector3 tempPosition = transform.position;
         tempPosition.z += 1.0f;
         transform.position = tempPosition;
       }
    }
}